| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.function.Supplier<T> |
memoize(java.util.function.Supplier<T> supplier)
Returns a memoizing supplier.
|
public static <T> java.util.function.Supplier<T> memoize(java.util.function.Supplier<T> supplier)
supplier will be called at most once, unless the call fails or returns null. Then the call will
be repeated.
The returned supplier does not allow null values, i.e. if the supplier returns null, a
NullPointerException will be raised.
The returned supplier is Serializable iff the supplier also is. The memoized value will not be
serialized.
Copyright © 2016. All rights reserved.