java get item in object code example
Example 1: java find item in list by property
Customer james = customers.stream()
.filter(customer -> "James".equals(customer.getName()))
.findAny()
.orElse(null);
Example 2: java list contains object with property
boolean found = list.stream()
.anyMatch(p -> p.name.equals(personName));