Koskamo

Processing data with the Stream API

Document v1 · published by Koskamo editorial · updated 2026-10-04

Original source

The Stream API, added in Java SE 8, implements the map-filter-reduce algorithm as a companion to the Collections Framework, which stores and organizes data in JVM memory. Open a stream on a collection, or create streams on I/O or custom data sources. Mapping transforms objects one-to-one via a Function, filtering selects elements via a Predicate, and reducing aggregates like SQL's COUNT, SUM, MIN, MAX, or AVERAGE. Intermediate operations return streams and process nothing until a terminal operation consumes elements one at a time; a stream stores no data. Call only one method per stream instance — reuse throws IllegalStateException — so create and consume streams on the spot, never modify the source, and avoid side effects. Scope: Java. Reviewed October 4, 2026.

Source and provenance

Original source
dev.java
Published on Koskamo by
Koskamo editorial
Citation version
Document v1
Reuse
Original summaries; linked sources retain their own terms.

The original source supplies the underlying information. Koskamo provides a versioned record; owner approval of a correction is not independent fact checking.