Java Reference
In-Depth Information
It must return true if val satisfies some constraint or condition. As it is used here, it will
return true if val is even.
Ask the Expert
Q :
At the start of this chapter, you mentioned that the inclusion of lambda expres-
sions resulted in new capabilities being incorporated into the API library. Can
you give me an example?
Q : One of the most important enhancements to the Java API library added by JDK 8 is
the new stream package java.util.stream . This package defines several stream
classes, the most general of which is Stream . As it relates to java.util.stream , a
stream is a conduit for data. Thus, a stream represents a sequence of objects. Further-
more, a stream supports many types of operations that let you create a pipeline that
performs a series of actions on the data. Often, these actions are represented by
lambda expressions. For example, using the stream API, you can construct sequences
of actions that resemble, in concept, the type of database queries for which you might
use SQL. Furthermore, in many cases, such actions can be performed in parallel, thus
providing a high level of efficiency, especially when large data sets are involved. Put
simply, the stream API provides a powerful means of handling data in an efficient,
Search WWH ::




Custom Search