Answers for "filter and map multiple fields from java stream"

0

filter and map multiple fields from java stream

// Note that you shouldn't normally use == on objects
Predicate<Detail> itemPredicate = d-> item.equals(d.getItem());
Predicate<Detail> namePredicate = d-> name.equals(d.getName());

details.stream()
    .filter(itemPredicate.and(namePredicate))
    .collect(Collectors.toList());
Posted by: Guest on May-20-2020

Code answers related to "filter and map multiple fields from java stream"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language