📅  最后修改于: 2022-03-11 14:52:07.682000             🧑  作者: Mango
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);