17.6 Stream<Employee> Manipulations
The example in Figs. 17.9–17.16 demonstrates various lambda and stream capabilities using a Stream<Employee>
. Class Employee
(Fig. 17.9) represents an employee with a first name, last name, salary and department and provides methods for manipulating these values. In addition, the class provides a getName
method (lines 69–72) that returns the combined first and last name as a String
, and a toString
method (lines 75–80) that returns a formatted String
containing the employee’s first name, last name, salary and department.
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.