Section 17.6.2 Filtering Employees with Salaries in a Specified Range

• To reuse a lambda, you can assign it to a variable of the appropriate functional interface type.

• The Comparator interface’s static method comparing (p. 753) receives a Function that’s used to extract a value from an object in the stream for use in comparisons and returns a Comparator object.

• A nice performance feature of lazy evaluation is the ability to perform short circuit evaluation—that is, to stop processing the stream pipeline as soon as the desired result is available.

Stream method findFirst is a short-circuiting terminal operation that processes the stream pipeline and terminates processing as soon as the first object from the stream pipeline is found. The ...

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.