java get object that matches condition code example
Example 1: find object with same attribute java stream
Optional<Person> matchingObject = objects.stream().
filter(p -> p.email().equals("testemail")).
findFirst();
Example 2: java 8 find in list by property
Optional<Person> matchingObject = objects.stream().
filter(p -> p.email().equals("testemail")).
findFirst();