Supplier functional interface – Java 8

/, Java 8/Supplier functional interface – Java 8

What is Supplier interface in Java 8?

java.util.function.Supplier is a functional interface whose functional method is  get(). The Supplier interface represents an operation that takes no argument and returns a result. As this is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

The following example shows how to use the get() method of the Supplier interface with Lambda expression and method reference.

Example with lambda expression :

Example with method reference :

Leave A Comment