What is Stream?
A sequence of elements supporting sequential and parallel aggregate operations.
How to create?
The java.util.Collection interface has two methods:
- stream()
- parallelStream() - supports parallel computing.
How to use?
The java.util.stream.Stream interface has several methods, here are the most common used.
filter
map
sorted
forEach
collect
java.util.stream.Collectors
Collectors are used of collecting result from Stream operations, but there are several useful methods in the java.util.stream.Collectors interface. Here some of them.