terminal operation

The final stream step, such as toList, collect, count or anyMatch, that starts the pipeline and produces a result.

In more detail

Nothing in a stream runs until a terminal operation asks for a result, and a stream can only be used once. The terminal operation decides the shape of the answer: a list, a set, a map, a single number or a yes-or-no answer.

Examples

.toList()
.collect(Collectors.toSet())

Related terms

Taught in

References

Certification courses