A Stream interface is a sequence of elements that can be filtered and transformed to get a final result sequentially or in parallel. This final result can be a primitive data type (an integer, a long ...), an object or a data structure. These are the characteristics that better define Stream:
- A stream is a sequence of data, not a data structure.
- You can create streams from different sources as collections (lists, arrays...), files, strings, or a class that provides the elements of the stream.
- You can't access an individual element of the streams.
- You can't modify the source of the stream.
- Streams define two kinds of operations: intermediate operations that produce a new Stream interface that allows ...