What Is a Stream
Description
A stream is a sequence of data values supporting sequential and parallel aggregate operations.
We use the aggregate functions in SQL more often. For example we can sum all sale figures for a month or a year. We can also get the max value for a give range.
An aggregate operation works on a list of item and results in a single value.
The result of an aggregate operation on stream may be a primitive value, an object, or a void for Stream. Like SQL we can calculate sum for all integers in a stream of integers.
Collections vs Streams
Java Collections focus on how to store data elements for efficient access.
Java streams focus on aggregate operations on data elements from a data source.