Package aQute.bnd.memoize
Class MemoizingSupplier<T>
java.lang.Object
aQute.bnd.memoize.MemoizingSupplier<T>
The object can exist in one of two states:
- initial which means the source supplier has not been called or has not returned a value acceptable to the predicate and memoized holds the wrapped supplier. From this state, the object can transition to open.
- open which means memoized is the value from the source supplier. This is the terminal state.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMemoizingSupplier
(Supplier<? extends T> supplier) MemoizingSupplier
(Supplier<? extends T> supplier, Predicate<? super T> predicate) -
Method Summary
-
Field Details
-
initial
private volatile boolean initial -
memoized
-
-
Constructor Details
-
MemoizingSupplier
-
MemoizingSupplier
-
-
Method Details
-
get
Description copied from interface:Memoize
Get the memoized value. -
peek
Description copied from interface:Memoize
Peek the memoized value, if any.This method will not result in a call to the source supplier.
-
isPresent
public boolean isPresent()Description copied from interface:Memoize
If a value is memoized, returntrue
. Otherwise returnfalse
.This method will not result in a call to the source supplier.
-
toString
-