/home/oracle/labs/06CollectionOperations/examples/EmployeeSearch/src/com/example/lambda/A13CollectJoin.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 oracle
11  */
12 public class A13CollectJoin {
13     
14     public static void main(String[] args) {
15         
16         List<Employee> eList = Employee.createShortList();
17        
18         // Collect CO Executives
19         String deptList = eList.stream()
20             .map(Employee::getDept)
21             .distinct()
22             .collect(Collectors.joining(", "));        
23 
24         System.out.println("\n== Dept List ==");
25         System.out.println("Total: " + deptList);        
26                 
27     }
28     
29 }
30