| Modifier and Type | Method and Description |
|---|---|
static <T> Supplier<T> |
constant(T value)
Returns a supplier that return a constant value.
|
static <T> Optional<T> |
firstMatching(Predicate<T> predicate,
ThrowingSupplier<T,Exception>... suppliers)
Returns the first value provide by the given suppliers that matches the given predicate.
|
static <T> Optional<T> |
firstNotNull(ThrowingSupplier<T,Exception>... suppliers)
Returns the first non null value provide by the given suppliers.
|
static <T> Supplier<T> |
memorize(Supplier<T> supplier)
Returns a supplier which caches the result of the first call to
Supplier.get()and returns that value on
subsequent calls. |
static <T> Supplier<T> |
memorize(ThrowingSupplier<T,? extends Exception> supplier,
Consumer<Exception> consumer)
Returns a supplier which caches the result of the first call to
Supplier.get() and returns that value on
subsequent calls. |
public static <T> Supplier<T> memorize(Supplier<T> supplier)
Supplier.get()and returns that value on
subsequent calls.T - the type of results supplied by this supplier.supplier - the delegate Supplier.Supplier.get() method.public static <T> Supplier<T> memorize(ThrowingSupplier<T,? extends Exception> supplier, Consumer<Exception> consumer)
Supplier.get() and returns that value on
subsequent calls.T - the type of results supplied by this supplier.supplier - the delegate Supplier.consumer - a consumer for any exception thrown by the ThrowingSupplier.get().Supplier.get() method.public static <T> Supplier<T> constant(T value)
T - the type of results supplied by this supplier.value - the constant value to return.value.@SafeVarargs public static <T> Optional<T> firstNotNull(ThrowingSupplier<T,Exception>... suppliers) throws Exception
T - the type of results supplied by this supplier.suppliers - a list of supplier.Exceptionpublic static <T> Optional<T> firstMatching(Predicate<T> predicate, ThrowingSupplier<T,Exception>... suppliers) throws Exception
T - the type of results supplied by this supplier.predicate - the predicate used to evaluate the computed values.suppliers - a list fo supplier.ExceptionApache Camel