The 30 second answer
Intermediate operations like filter and map return a new stream and stay lazy. Terminal operations like collect and forEach trigger the traversal and consume the pipeline. Intermediate ops are either stateless or stateful, and short-circuiting ones like findFirst can finish early even on infinite streams.
Intermediate ops (filter, map, sorted, …) return a new stream and are lazy. Terminal ops (forEach, collect, reduce, count, …) trigger traversal and consume the pipeline.
Intermediate ops are further stateless (filter, map) or stateful (distinct, sorted, which may need to see the whole input). Short-circuiting ops (limit, findFirst, anyMatch) can finish on infinite streams.
Sources:
Sources (0)
See inline citations in the answer above.