T
- The type of the function output.@ConsumerType @FunctionalInterface public interface Supplier<T>
This is a functional interface and can be used as the assignment target for a lambda expression or method reference.
Modifier and Type | Method and Description |
---|---|
static <T> Supplier<T> |
asJavaSupplier(Supplier<T> wrapped)
Returns a
java.util.function.Supplier which wraps the specified
Supplier and throws any thrown exceptions. |
static <T> Supplier<T> |
asJavaSupplierOrElse(Supplier<T> wrapped,
T orElse)
Returns a
java.util.function.Supplier which wraps the specified
Supplier and the specified value. |
static <T> Supplier<T> |
asJavaSupplierOrElseGet(Supplier<T> wrapped,
Supplier<? extends T> orElseGet)
Returns a
java.util.function.Supplier which wraps the specified
Supplier and the specified java.util.function.Supplier . |
static <T> Supplier<T> |
asSupplier(Supplier<T> wrapped)
Returns a
Supplier which wraps the specified
java.util.function.Supplier . |
T |
get()
Returns a value.
|
T get() throws Exception
Exception
- An exception thrown by the method.static <T> Supplier<T> asJavaSupplier(Supplier<T> wrapped)
java.util.function.Supplier
which wraps the specified
Supplier
and throws any thrown exceptions.
The returned java.util.function.Supplier
will throw any exception
thrown by the wrapped Supplier
.
T
- The type of the function output.wrapped
- The Supplier
to wrap. Must not be null
.java.util.function.Supplier
which wraps the specified
Supplier
.static <T> Supplier<T> asJavaSupplierOrElse(Supplier<T> wrapped, T orElse)
java.util.function.Supplier
which wraps the specified
Supplier
and the specified value.
If the the specified Supplier
throws an Exception
, the
the specified value is returned.
T
- The type of the function output.wrapped
- The Supplier
to wrap. Must not be null
.orElse
- The value to return if the specified Supplier
throws an Exception
.java.util.function.Supplier
which wraps the specified
Supplier
and the specified value.static <T> Supplier<T> asJavaSupplierOrElseGet(Supplier<T> wrapped, Supplier<? extends T> orElseGet)
java.util.function.Supplier
which wraps the specified
Supplier
and the specified java.util.function.Supplier
.
If the the specified Supplier
throws an Exception
, the
value returned by the specified java.util.function.Supplier
is
returned.
T
- The type of the function output.wrapped
- The Supplier
to wrap. Must not be null
.orElseGet
- The java.util.function.Supplier
to call for a
return value if the specified Supplier
throws an
Exception
.java.util.function.Supplier
which wraps the specified
Supplier
and the specified
java.util.function.Supplier
.static <T> Supplier<T> asSupplier(Supplier<T> wrapped)
Supplier
which wraps the specified
java.util.function.Supplier
.T
- The type of the function output.wrapped
- The java.util.function.Supplier
to wrap. Must not
be null
.Supplier
which wraps the specified
java.util.Supplier.Function
.Copyright © Contributors to the Eclipse Foundation Licensed under the Eclipse Foundation Specification License – v1.0