How to create streams • Applying different operations with streams • Collecting data with streams • Grouping • Partitioning • Finding and matching • Conclusion • References
of data elements supporting sequential and parallel aggregate operations. • Consumes elements from its data source • Focus on aggregagte computations • Have no storage • Can represent a sequence of infinite elements • Support functional programming • Stream are not reusable
takes two parameters: - A classifier that is a function to generate the keys in the map. - A collector that performs a reduction operation on the values associated with each key: collect(Collectors.groupingBy(Person::getGen der, Collectors.counting()));
data • Grouping data is based on the keys returned from a function • Partitioning groups data into two groups: - For one group a condition is true - For the other, the same condition is false • The partitioning condition is specified using a Predicate: books .stream() .collect(Collectors.partitioningBy(Book::isProgramming));
supporting sequential and parallel aggregate operations. • Streams are connected through operations forming a pipeline. • Streams support two types of operations: intermediate and terminal operations. • Streams allows making aggregation operations on collections in functional programming style