More Java 8 Method Reference

This tutorial covers more Method Reference examples. If you haven’t already, I first advise you to read the introduction on this subject. Method References types in Java 8 In Java 8 you can have: Reference to static method: Math::sqrt; Reference to instance method of an object: person::getInfo, this::listenTo; Reference to instance method of a particular … Read more

Java 8 – Function Interface Example

The Function interface is probably the most versatile functional interface from the java.util.function package. The reason is because it can be used as a callback. A very similar interface is javafx.util.Callback; Java 8 Function Interface .apply() method The Function interface has two parameters: . First one is the type passed as an argument and the … Read more

Java 8 – Introduction to Lambda Expressions

In functional programming paradigm a lambda expression is a function without a name. An anonymous function. You can pass a lambda everywhere where is expected a functional interface. A function interface is an interface that has only one abstract method. Examples of functional interfaces already existent in Java: Runnable, Comparable etc. Java 8 Lambda Example … Read more