Supplier Interface in Java with Examples Read Discuss Courses Practice Improve Improve Improve Like Article Like Save Article Save Report issue Report The Supplier Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents a function which does not take in any argument but produces a value of type T. Hence this functional interface takes in only one generic namely:- T: denotes the type of the result The lambda expression assigned to an object of Supplier type is used to define its get() which eventually produces a value. Suppliers are useful when we don’t need to supply any value and obtain a result at the same time. The Supplier interface consists of only one function: 1. get() This method does not take in any argument but produces a value of type T. Syntax: T get() Returns: This method returns a value of type T. Below is the code to illustrate get() method: Program: import java.util.function.Supplier; public class Main { public static void main(String args[]) { // This function returns a random value. Supplier<Double> randomValue = () -> Math.random(); // Print the random value using get() System.out.println(randomValue.get()); } } Output: 0.5685808855697841 Feeling lost in the vast world of Backend Development? It's time for a change! Join our Java Backend Development - Live Course and embark on an exciting journey to master backend development efficiently and on schedule. What We Offer: Comprehensive Course Expert Guidance for Efficient Learning Hands-on Experience with Real-world Projects Proven Track Record with 100,000+ Successful Geeks Last Updated : 08 Oct, 2018 Like Article Save Article Previous Function Interface in Java with Examples Next Method References in Java with examples Please Login to comment...