public final class Lazy extends Object
| Constructor and Description |
|---|
Lazy() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Supplier<T> |
callable(Callable<T> factory)
Memoizing reference that is lazily computed using the supplied factory.
|
static <T> ResettableLazyReference<T> |
resettable(Supplier<T> factory)
Returns a
ResettableLazyReference which creates the value by
applying the provided Supplier. |
static <T> ResettableLazyReference<T> |
resettableCallable(Callable<T> factory)
Returns a
ResettableLazyReference which creates the value by
applying the provided Callable. |
static <T> Supplier<T> |
supplier(Supplier<T> factory)
Memoizing reference that is lazily computed using the supplied factory.
|
static <T> Supplier<T> |
timeToIdle(Supplier<T> factory,
long time,
TimeUnit unit)
Memoizing reference that expires the specified amount of time after the
last time it was accessed.
|
static <T> Supplier<T> |
timeToLive(Supplier<T> factory,
long time,
TimeUnit unit)
Memoizing reference that expires the specified amount of time after
creation.
|
public static <T> Supplier<T> supplier(Supplier<T> factory)
The factory is not held on to after it is used, enabling
it to be garbage collected.
T - the type.factory - for populating the initial value, called only once.public static <T> Supplier<T> callable(Callable<T> factory)
The factory is not held on to after it is used, enabling
it to be garbage collected.
T - the type.factory - for populating the initial value, called only once.public static <T> Supplier<T> timeToLive(Supplier<T> factory, long time, TimeUnit unit)
T - the type.factory - for populating the initial value, called only once.time - the amountunit - the units the amount is inpublic static <T> Supplier<T> timeToIdle(Supplier<T> factory, long time, TimeUnit unit)
T - the type.factory - for populating the initial value, called only once.time - the amountunit - the units the amount is inpublic static <T> ResettableLazyReference<T> resettable(Supplier<T> factory)
ResettableLazyReference which creates the value by
applying the provided Supplier.T - the type of the contained element.factory - that creates the value that will be held by the
ResettableLazyReference.ResettableLazyReference which creates the value by
applying the provided Supplier.public static <T> ResettableLazyReference<T> resettableCallable(Callable<T> factory)
ResettableLazyReference which creates the value by
applying the provided Callable.T - the type of the contained element.factory - that creates the value that will be held by the
ResettableLazyReference.ResettableLazyReference which creates the value by
applying the provided Callable.Copyright © 2024 Atlassian. All rights reserved.