What do you mean by Pipeline of Operations?
xxxxxxxxxx
To perform a sequence of operations over the elements of the data source and process and get the results,
There are three things Required
Data source
Intermediate operation(s)
Terminal operation.
Data Source is the Dataset or collection to which the Stream will be created.
There are various operations in Stream that is Intermediate -
filter()
map()
flatMap()
distinct()
sorted()
peek()
limit()
skip()
Intermediate operations are lazy and will not be called until the Terminal operation is called. To identify if the operation is Intermediate
or not we can check
If the operation is returning another stream it is called intermediate operation.
The terminal operation is the final operations that will be called after triggering the Intermediate operations.
Some of the Example of Terminal operations are.
toArray()
collect()
count()
reduce()
forEach()
forEachOrdered()
min()
max()
anyMatch()
allMatch()
noneMatch()
findAny()
findFirst()