17.6.1 Creating and Displaying a List<Employee>

Class ProcessingEmployees (Figs. 17.1017.16) is split into several figures so we can show you the lambda and streams operations with their corresponding outputs. Figure 17.10 creates an array of Employees (lines 17–24) and gets its List view (line 27).

 1   // Fig. 17.10: ProcessingEmployees.java 2   // Processing streams of Employee objects. 3   import java.util.Arrays; 4   import java.util.Comparator; 5   import java.util.List; 6   import java.util.Map;                7   import java.util.TreeMap;            8   import java.util.function.Function;  9   import java.util.function.Predicate;10   import java.util.stream.Collectors; 11 12   public class ProcessingEmployees ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.