|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.common.base.Suppliers
public final class Suppliers
Useful suppliers.
Nested Class Summary | |
---|---|
static class |
Suppliers.CyclicDependencyException
Exception thrown when a memoizing supplier tries to get its own value. |
Method Summary | ||
---|---|---|
static
|
compose(Function<? super F,? extends T> function,
Supplier<? extends F> first)
Returns a new supplier which is the composition of the provided function and supplier. |
|
static
|
memoize(Supplier<T> delegate)
Returns a supplier which caches the instance retrieved during the first call to get() and returns that value on subsequent calls to
get() . |
|
static
|
ofInstance(T instance)
Returns a supplier that always supplies instance . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <F,T> Supplier<T> compose(Function<? super F,? extends T> function, Supplier<? extends F> first)
first
, and then applying
function
to that value. Note that the resulting supplier will not
call first
or invoke function
until it is called.
public static <T> Supplier<T> memoize(Supplier<T> delegate)
get()
and returns that value on subsequent calls to
get()
. See:
memoization
The returned supplier will throw CyclicDependencyException
if
the call to Supplier.get()
tries to get its own value. The returned
supplier is not thread-safe.
public static <T> Supplier<T> ofInstance(@Nullable T instance)
instance
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |