In my Code ,I have used Null Object checker and simply applied a conditional Statement there , if condition is false (ie.Object == null) it should continue the loop giving sort of warning else add that Object's value in a List.
Boolean isDobNull =
Objects
.requireNonNull( userDob )
.toInstant()
.isBefore(
Instant.now()
)
;
if(isDobNull == false || isDobNull == null){
log.warn("DOB is missing: "+ activeUser.getUserName());
continue;
}else {
// statements
}