public class Suppliers extends Object
| Constructor and Description |
|---|
Suppliers() |
| Modifier and Type | Method and Description |
|---|---|
static Supplier<Boolean> |
alwaysFalse()
Supplies false.
|
static <A> Supplier<A> |
alwaysNull()
Always returns null.
|
static Supplier<Boolean> |
alwaysTrue()
Supplies true.
|
static <A,B> Supplier<B> |
ap(Supplier<A> sa,
Supplier<Function<A,B>> sf)
Performs function application within a supplier (applicative functor
pattern).
|
static <A,B> Supplier<B> |
compose(Function<? super A,B> transform,
Supplier<A> first)
|
static <A,B> Supplier<B> |
fromFunction(Function<? super A,? extends B> f,
A a)
Constantly applies the input value to the supplied function, and returns
the result.
|
static <A> Supplier<A> |
fromOption(Option<A> option)
Turns an Option into a supplier, but throws an exception if undefined.
|
static <A> Supplier<A> |
memoize(Supplier<A> supplier)
A supplier that memoize the value return by another
Supplier, whose
Supplier.get() method is guaranteed to be call
at most once. |
static <A> Supplier<A> |
ofInstance(A a)
Creates a
Supplier of a constant value. |
static <A> Supplier<A> |
weakMemoize(Supplier<A> supplier)
|
public static <A> Supplier<A> ofInstance(A a)
Supplier of a constant value.A - the typea - the constant value to supplyinstance.public static <A,B> Supplier<B> ap(Supplier<A> sa, Supplier<Function<A,B>> sf)
sa - suppliersf - The Supplier function to apply.public static Supplier<Boolean> alwaysTrue()
true.public static Supplier<Boolean> alwaysFalse()
false.public static <A> Supplier<A> alwaysNull()
A - the typenull.public static <A> Supplier<A> fromOption(Option<A> option)
A - the typeoption - the option to attempt to get values fromSupplier that always calls
Maybe.get(), which throws an Exception if the
option is Nonepublic static <A,B> Supplier<B> fromFunction(Function<? super A,? extends B> f, A a)
A - the input typeB - the result typef - the functiona - the valueSupplier that always calls
Function.apply(Object)public static <A> Supplier<A> memoize(Supplier<A> supplier)
Supplier, whose
Supplier.get() method is guaranteed to be call
at most once. The returned Supplier is
thread-safeA - the typesupplier - the supplier to memoizeCopyright © 2018 Atlassian. All rights reserved.