intermediate operation

A stream step, such as filter, map, sorted or distinct, that returns another stream and does no work until a terminal operation runs.

In more detail

filter keeps elements that match a condition and map transforms each element. Because they are lazy, building a long pipeline costs nothing until the result is requested. Some intermediate operations, such as sorted and distinct, must remember elements and so hold state.

Examples

.filter(User::active)
.map(User::name)

Related terms

Taught in

References

Certification courses