How can I code the logic below using Optional and lambda? I have two Lists
List success = new ArrayList<>();
List failures = new ArrayList<>();
And there is an object
RoomTypes value
for which value.getErrorType()
could be NULL or not and value.getId()
returns integer.
I would like to update success
and failure
with value.getId()
list according to value.getErrorType()
being null.
Something like:
if(value.getErrorType().equals(NULL)){
success.add(value.getId())
}
else{
failure.add(value.getId())
}
Aucun commentaire:
Enregistrer un commentaire