Is there a better meaning more readable way to express this?
List<LocationVO> listLocation = listLocationAll.stream().filter(l -> {
boolean ok = true;
if ( filter.getClient_id() != null && filter.getClient_id().longValue() != l.getParent_client_id() ) {
ok = false;
}
if ( filter.getLocation_id() != null && filter.getLocation_id().longValue() != l.getLocation_id() ) {
ok = false;
}
if (filter.getLocation_type() != null && (filter.getLocation_type().equals(l.getLocation_type()) == false) ) {
ok = false;
}
return ok;
}).collect(Collectors.toList());
Aucun commentaire:
Enregistrer un commentaire