/home/oracle/labs/07ParallelStreams/examples/EmployeeSearch/src/com/example/lambda/A06Determine.java
 1 package com.example.lambda;
 2 
 3 import java.util.List;
 4 
 5 
 6 /**
 7  *
 8  * @author oracle
 9  */
10 public class A06Determine {
11     
12     public static void main(String[] args) {
13         
14         List<Employee> eList = Employee.createShortList();
15         
16         double r1 = eList.stream()
17             .filter(e -> e.getState().equals("CO"))
18             .mapToDouble(Employee::getSalary)
19             .sequential().sum();
20         
21         double r2 = eList.stream()
22             .filter(e -> e.getState().equals("CO"))
23             .mapToDouble(Employee::getSalary)
24             .parallel().sum();
25         
26         System.out.println("The same: " + (r1 == r2));
27     }
28 }
29