... calls in lines 9–10 create a stream pipeline. A stream is a sequence of elements on which you perform tasks, and the stream pipeline moves the stream’s elements through a sequence of tasks (or processing steps).
Specifying the Data Source
A stream pipeline typically begins with a method call that creates the stream—this is known as the data source. Line 9 specifies the data source with the method call
IntStream.rangeClosed(1, 10)
which creates an IntStream
representing an ordered range of int
values. ...
Get Java How to Program, Early Objects, 11th 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.