Tag Archives: Stream

Stream Reduction Operations

In this post I will make overview with examples of Collectors class which provides very cool functionality that can be applied on a stream. The functionality is quite similar to some features in SQL language. For instance, it allows you to make an averaging, grouping, partitioning, summing and many other cool things. In order to use stream reduction API you need to be familiar with Collector interface and Collectors class.

Screen Shot 2016-03-30 at 20.34.29

Collectors is an utility class that contains factory methods which you should use most of the time, whereas Collector is an interface that can be used for implementation more specific reduction operation.
Continue reading Stream Reduction Operations

Stream Operations Overview

One of the greatest thing in Java 8 is new Stream API which essentially is a new fancy iterator over the collections or any other sequence of data. To work with Streams you need to compose a stream pipeline which consists of source, zero or more intermediate operations and a terminal operation.

Screen Shot 2016-03-26 at 09.39.36

The interfaces and classes that belongs to stream API can be found in java.util.stream package.
Continue reading Stream Operations Overview