Intermediate and Terminal operations in java 8
Intermediate and Terminal operations in Java 8
Intermediate Operations |
Terminal Operations |
---|---|
They return stream. |
They return non-stream values. |
They can be chained together to form a pipeline of operations. |
They can’t be chained together. |
Pipeline of operations may contain any number of intermediate operations. |
Pipeline of operations can have maximum one terminal operation, that too at the end. |
Intermediate operations are lazily loaded. |
Terminal operations are eagerly loaded. |
They don’t produce end result. |
They produce end result. |