public final class MoreSuppliers
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T> Spplr<T> |
cache(Spplr<T> supplier)
Wrap the given supplier in a supplier that will only call the underlying supplier once,
and then cache the returned value.
|
static <T,R> Spplr<R> |
map(Spplr<T> supplier,
Func<T,R> function)
Create a supplier that will transform the value returned by the given supplier by invoking the given function on it.
|
static <T> Spplr<T> |
of(T value)
Create a supplier that will return the given value.
|
public static <T> Spplr<T> of(T value)
T - Value type.value - Value to return.Spplr that will return the given constant value.public static <T,R> Spplr<R> map(Spplr<T> supplier, Func<T,R> function)
T - Supplied value type.R - Transformed value type.supplier - Supplier to transform.function - Function to transform the supplier with.Spplr that will apply the given function to the value supplied by the given supplier.public static <T> Spplr<T> cache(Spplr<T> supplier)
T - Supplied value type.supplier - Supplier to cache.Spplr that will call the wrapped supplier once and only once and cache the value for future
calls.