Pipelines and Steams
A pipeline is a sequence of aggregate operations, containing the following components: a source; zero or more intermediate operations and a terminal operation.
Aggregate Operation区别于Iterators的地方:
- They use internal iteration: Aggregate operations do not contain a method like
next
to instruct them to process the next element of the collection. With internal delegation, your application determines what collection it iterates, but the JDK determines how to iterate the collection. With external iteration, your application determines both what collection it iterates and how it iterates it. However, external iteration can only iterate over the elements of a collection sequentially. In