/home/oracle/labs/07ParallelStreams/examples/EmployeeSearch/src/com/example/lambda/A02NewStyleLoop.java
 1 package com.example.lambda;
 2 
 3 import java.util.List;
 4 
 5 /**
 6  *
 7  * @author oracle
 8  */
 9 public class A02NewStyleLoop {
10 
11     public static void main(String[] args) {
12         
13         List<Employee> eList = Employee.createShortList();
14         
15         double result = eList.stream()
16             .filter(e -> e.getState().equals("CO"))
17             .filter(e -> e.getRole().equals(Role.EXECUTIVE))
18             .peek(e -> e.printSummary())
19             .mapToDouble(e -> e.getSalary())
20             .sum();
21         
22         System.out.printf("Total CO Executive Pay: $%,9.2f %n", result);               
23     }
24     
25 }
26