Articles

Project Lambda is an effort to bring Java into the world of functional programming. 

Lambda is a function without a name. It is an implementation of functional interfaces. A functional interface is an interface that has only a single custom abstract method that isn’t inherited from the object class. In Java, interfaces such as Runnable, Comparable, and many others are the example of Functional Interfaces. It defines an anonymous implementation for one-time use and significantly streamlines your code.

Source de l’article sur DZONE

To bind methods or constructors to functional interfaces, we are going to use the FunctionalInterfaceFactory of Burningwave Core library. FunctionalInterfaceFactory component uses to cache all generated functional interfaces for faster access. Before we start coding, we must add the following dependency to our pom.xml:

XML

 

x
 

1

<dependency>

2

    <groupId>org.burningwave</groupId>

3

    <artifactId>core</artifactId>

4

    <version>8.12.6</version>

5

</dependency>

Constructors Binding

To bind a constructors to a functional interface, we will use the following constructor:

Source de l’article sur DZONE