📜  具有多个条件的流过滤器 - Java 代码示例

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

代码示例1
List employeeList = getEmployeesFromDataSource();
Predicate isEmployeeActive = e -> e.getStatus() == EmployeeStatus.ACTIVE;
String result = employeeList.stream()
                .filter(isEmployeeActive)
                .map(e -> e.getId().toString())
                .collect(Collectors.joining(",", "[", "]"));
         
        System.out.println("Active employees = " + result);