| /home/oracle/labs/06CollectionOperations/examples/EmployeeSearch/src/com/example/lambda/A11Collect.java |
1 package com.example.lambda;
2
3 import java.util.ArrayList;
4 import java.util.Comparator;
5 import java.util.List;
6 import java.util.stream.Collectors;
7
8
9
10 @author
11
12 public class A11Collect {
13
14 public static void main(String[] args) {
15
16 List<Employee> eList = Employee.createShortList();
17
18 List<Employee> nList = new ArrayList<>();
19
20
21 nList = eList.stream()
22 .filter(e -> e.getRole().equals(Role.EXECUTIVE))
23 .filter(e -> e.getState().equals("CO"))
24 .sorted(Comparator.comparing(Employee::getSurName))
25 .collect(Collectors.toList());
26
27 System.out.println("\n== CO Bonus Details ==");
28
29 nList.stream()
30 .forEach(Employee::printSummary);
31
32 }
33
34 }
35