Supplier Functional Interface
In this lesson, we will look at the supplier functional interface.
We'll cover the following
Supplier
is an interface that does not take in any argument but produces a value when the get()
function is invoked. Suppliers are useful when we don’t need to supply any value and obtain a result at the same time.
Below are some of the functional interfaces, which can be categorized as a supplier.
Interface Name | Description | Abstract Method |
---|---|---|
Supplier<T> |
Represents a supplier of results (reference type) | T get() |
DoubleSupplier |
A supplier of double-value results | double getAsDouble() |
IntSupplier |
A supplier of int-value results | int getAsInt() |
LongSupplier |
A supplier of long-value results | long getAsLong() |
BooleanSupplier |
A supplier of boolean-value results | boolean getAsBoolean() |
Get hands-on with 1400+ tech skills courses.