public class Suppliers extends Object
Constructor and Description |
---|
Suppliers() |
Modifier and Type | Method and Description |
---|---|
static <T> Supplier<T> |
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() . |
public static <T> Supplier<T> memoize(Supplier<T> delegate)
get()
and returns that value on subsequent calls to
get()
. See:
memoization
The returned supplier is thread-safe. The delegate's get()
method will be invoked at most once. The supplier's serialized form does
not contain the cached value, which will be recalculated when get()
is called on the reserialized instance.
If delegate
is an instance created by an earlier call to memoize
, it is returned directly.
Copyright © 2019 JBoss by Red Hat. All rights reserved.