(OCP) Oracle Certified Professional Practice Test
OCP - Oracle Certified Professional OCP Streams and Lambda Expressions Questions and Answers
Which of the following best describes the core difference between intermediate and terminal operations in the Java Stream API?
Select your answer
A
Intermediate operations are optional, while every stream pipeline must end with a terminal operation.
B
Intermediate operations are lazy and return a new stream, while terminal operations are eager and produce a result or side-effect.
C
Intermediate operations, like `map()` and `filter()`, can only be chained once, whereas terminal operations can be chained multiple times.
D
Terminal operations can only be applied to parallel streams, while intermediate operations work for both sequential and parallel streams.
Hint