Answers for "find an object in list by filter java"

2

java find item in list by property

Customer james = customers.stream()
  .filter(customer -> "James".equals(customer.getName()))
  .findAny()
  .orElse(null);
Posted by: Guest on February-19-2020
1

find object with same attribute java stream

Optional<Person> matchingObject = objects.stream().
    filter(p -> p.email().equals("testemail")).
    findFirst();
Posted by: Guest on December-09-2020

Code answers related to "find an object in list by filter java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language