Quick Answer
Intermediate operations are lazy - they don't execute until a terminal op is called and return a Stream. Examples: filter(), map(), flatMap(), sorted(), distinct(), limit(), peek(). Terminal operations trigger execution and produce a result or side effect. Examples: collect(), count(), forEach(), reduce(), findFirst(), anyMatch(), toList(). Only one terminal operation per stream pipeline.
Answer
Intermediate operations are lazy and return streams (map, filter, sorted). Terminal operations produce results (collect, forEach, reduce). Pipeline allows chaining multiple intermediate operations.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.