Skip to content

Terminal operations (TerminalOp)

Terminal operations are a specific type of operation within the Java Stream API that serve to conclude or evaluate the stream pipeline.^[600-developer__java__java8__java8-stream.md]

In the architecture of a Java Stream, operations are typically categorized into intermediate and terminal stages. Terminal operations are responsible for traversing the stream pipeline to produce a result or a side-effect. Once a terminal operation is invoked on a stream, the stream is considered consumed and cannot be used further.^[600-developer__java__java8__java8-stream.md]

Relationship to AbstractPipeline

The execution of streams, including the invocation of terminal operations, is managed by the AbstractPipeline class.^[600-developer__java__java8__java8-stream.md] This abstract base class acts as the core implementation for the Stream interface, handling the construction and evaluation of the stream pipeline.^[600-developer__java__java8__java8-stream.md]

Sources

  • 600-developer__java__java8__java8-stream.md