Skip to content
Brendan Cheong Ern Jie edited this page Oct 12, 2021 · 21 revisions

Streams

The stream data structure was introduced in java 8 and is used in functional programming, where data is manipulated in a self contained data pipeline. Streams aim to replace the for loop and are considered a type of declarative programming as opposed to imperative programming, where we write code that tells the program what we want but not how to get it instead of telling the program step by step how to get what we want.

Thus, in streams we completely remove the need for a for loop and avoid needing state management which can cause mutable data structures, leading to bugs (thats why al streams are self-contained).

Clone this wiki locally