|
||||||||||
| 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<K,V> function,
Supplier<? extends K> first)
Returns a new Supplier which is the composition of the Function function and the Supplier first. |
|
static
|
memoize(Supplier<T> delegate)
Returns a Supplier which delegates to the given Supplier
on the first call to get(), records the value returned, and returns this
recorded value on all 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 <K,V> Supplier<V> compose(Function<K,V> function,
Supplier<? extends K> first)
Supplier which is the composition of the Function function and the Supplier first. In other words, this
new Supplier's value will be computed by retrieving the value from
first, and then applying function to that value. Note that
the resulting Supplier will not force first (or
invoke function) until it is, itself, forced.
public static <T> Supplier<T> memoize(Supplier<T> delegate)
Supplier which delegates to the given Supplier
on the first call to get(), records the value returned, and returns this
recorded value on all subsequent calls to get(). See:
memoization
The returned Supplier will throw CyclicDependencyException
if the call to get() tries to get its own value.
The returned supplier is not MT-safe.
public static <T> Supplier<T> ofInstance(@Nullable
T instance)
Supplier that always supplies instance.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||