streams

Java Streams are a powerful and flexible abstraction for processing sequences of data

Stream source

Collections, Arrays, or I/O channels, etc.

Intermediate Operations

To manipulate the data in stream but not return anything

Examples :

  • filter()

  • map()

  • sort()

Terminal Operations

Stop stream processing and return values from the stream

Examples :

  • forEach()

  • toArray()

  • reduce()

  • min() / max()

Example

Last updated