📜  从 java 流中过滤和映射多个字段 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:44.801000             🧑  作者: Mango

代码示例1
// Note that you shouldn't normally use == on objects
Predicate itemPredicate = d-> item.equals(d.getItem());
Predicate namePredicate = d-> name.equals(d.getName());

details.stream()
    .filter(itemPredicate.and(namePredicate))
    .collect(Collectors.toList());