Package org.osgi.util.function
Interface Supplier<T>
- Type Parameters:
T- The type of the function output.
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A function that produces a result.
This is a functional interface and can be used as the assignment target for a lambda expression or method reference.
- "ThreadSafe"
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Supplier<T>asJavaSupplier(Supplier<T> wrapped) Returns ajava.util.function.Supplierwhich wraps the specifiedSupplierand throws any thrown exceptions.static <T> Supplier<T>asJavaSupplierOrElse(Supplier<T> wrapped, T orElse) Returns ajava.util.function.Supplierwhich wraps the specifiedSupplierand the specified value.static <T> Supplier<T>asJavaSupplierOrElseGet(Supplier<T> wrapped, Supplier<? extends T> orElseGet) Returns ajava.util.function.Supplierwhich wraps the specifiedSupplierand the specifiedjava.util.function.Supplier.static <T> Supplier<T>asSupplier(Supplier<T> wrapped) Returns aSupplierwhich wraps the specifiedjava.util.function.Supplier.get()Returns a value.
-
Method Details
-
get
Returns a value.- Returns:
- The output of this function.
- Throws:
Exception- An exception thrown by the method.
-
asJavaSupplier
Returns ajava.util.function.Supplierwhich wraps the specifiedSupplierand throws any thrown exceptions.The returned
java.util.function.Supplierwill throw any exception thrown by the wrappedSupplier.- Type Parameters:
T- The type of the function output.- Parameters:
wrapped- TheSupplierto wrap. Must not benull.- Returns:
- A
java.util.function.Supplierwhich wraps the specifiedSupplier.
-
asJavaSupplierOrElse
Returns ajava.util.function.Supplierwhich wraps the specifiedSupplierand the specified value.If the the specified
Supplierthrows anException, the the specified value is returned.- Type Parameters:
T- The type of the function output.- Parameters:
wrapped- TheSupplierto wrap. Must not benull.orElse- The value to return if the specifiedSupplierthrows anException.- Returns:
- A
java.util.function.Supplierwhich wraps the specifiedSupplierand the specified value.
-
asJavaSupplierOrElseGet
static <T> Supplier<T> asJavaSupplierOrElseGet(Supplier<T> wrapped, Supplier<? extends T> orElseGet) Returns ajava.util.function.Supplierwhich wraps the specifiedSupplierand the specifiedjava.util.function.Supplier.If the the specified
Supplierthrows anException, the value returned by the specifiedjava.util.function.Supplieris returned.- Type Parameters:
T- The type of the function output.- Parameters:
wrapped- TheSupplierto wrap. Must not benull.orElseGet- Thejava.util.function.Supplierto call for a return value if the specifiedSupplierthrows anException.- Returns:
- A
java.util.function.Supplierwhich wraps the specifiedSupplierand the specifiedjava.util.function.Supplier.
-
asSupplier
Returns aSupplierwhich wraps the specifiedjava.util.function.Supplier.- Type Parameters:
T- The type of the function output.- Parameters:
wrapped- Thejava.util.function.Supplierto wrap. Must not benull.- Returns:
- A
Supplierwhich wraps the specifiedjava.util.Supplier.Function.
-