Stream API

The standard-library toolkit for describing a sequence of data-processing steps, such as filter, map and collect, over a source like a list.

In more detail

A stream pipeline has a source, zero or more lazy intermediate operations, and one terminal operation that starts the work and produces a result. The source collection is not changed. Streams are a vocabulary for data flow, not a replacement for every loop, and callbacks inside them should avoid side effects.

Example

Stream.of("Ada", "Bob", "Ana").filter(n -> n.startsWith("A")).map(String::toUpperCase).toList()

Related terms

Taught in

References

Certification courses