Tag Archives: lambda

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

Functional Interfaces Overview

Java 8 provided a lot of new and very useful features that we can use in our everyday life. In this post I decided make an overview with examples of most  commonly used built-in functional interfaces.

lambda

I’d like to start from the definition, what is the functional interface? By the definition any interface that has only one abstract method is considered to be a functional interface. Another name for such interfaces is Single Abstract Method interfaces (SAM Interfaces). For instance, Runnable is absolutely legal FI and as you can see it’s annotated now with FunctionalInterface annotation. Continue reading Functional Interfaces Overview