I have an object, Person
, which has two properties Name
and Status
. From a list of objects I hope to filter out the Person
objects with a status of In Progress
. Here is my code:
personList.stream().filter(
t -> t.getStatus().equalsIgnoreCase(
"In Progress")).collect(Collectors.toList());
But the code is throwing a nullpointerexception
error. When I checked, I saw that a few of the objects with In Progress
status had null values. How do we handle this in lambda?