Streams

A Stream is a sequence of elements processed declaratively through a pipeline: a source, lazy intermediate operations (filter, map, sorted), and a terminal operation (collect, count, forEach). It does not modify the source and can only be consumed once.

Example

List<String> r = noms.stream()
    .filter(n -> n.length() > 3)
    .map(String::toUpperCase)
    .toList();

Related concepts

The whole glossary