Package aQute.lib.memoize
Class MemoizingSupplier<T>
- java.lang.Object
-
- aQute.lib.memoize.MemoizingSupplier<T>
-
- All Implemented Interfaces:
Memoize<T>
,java.util.function.Supplier<T>
class MemoizingSupplier<T> extends java.lang.Object implements Memoize<T>
The object can exist in one of two states:- initial which means
get
has not been called and memoized holds the wrapped supplier. From this state, the object can transition to open. - open which means memoized is the value from the wrapped supplier. This is the terminal state.
-
-
Constructor Summary
Constructors Constructor Description MemoizingSupplier(java.util.function.Supplier<? extends T> supplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get()
T
peek()
Peek the memoized value, if any.
-
-
-
Constructor Detail
-
MemoizingSupplier
MemoizingSupplier(java.util.function.Supplier<? extends T> supplier)
-
-