stream pipeline in Java

A stream pipeline is the operations that run on a stream to produce a result. There are three parts to a stream pipeline:
* Source: Where the stream comes from.
* Intermediate operations: Transforms the stream into another one. There can be as few or as many intermediate operations as you’d like. Since streams use lazy evaluation, the intermediate operations do not run until the terminal operation runs. 
* Terminal operation: Actually produces a result. Since streams can be used only once, the stream is no longer valid after a terminal operation completes.

<b>Intermediate vs. terminal operations</b>
Scenario | For Intermediate Operations?  | For Terminal Operations?
----- | ----- | ----
Is required part of a useful pipeline?  | No  | Yes
Can exist multiple times in a pipeline?  | Yes  | No
Return type is a stream type?  | Yes  | No
Executed upon method call?  | No  | Yes
Stream valid after call?  | Yes  | No