Interface LazyValue<T>
- Type Parameters:
T
- the type to supply
- All Superinterfaces:
Supplier<T>
- All Known Implementing Classes:
SimpleLazyValue
,ThreadSafeLazyValue
Represents a Lazy-loaded value which is loaded only on the first call to get. Though it is not a functional
interface, it does extend
Supplier
so it can easily drop-in directly to various standard APIs.
The interface makes no gaurantees as to thead safety, however specific implementations may.-
Method Summary
Modifier and TypeMethodDescriptionget()
Gets the value of thisSimpleLazyValue
, computing it if it was not already computed.Gets anOptional
representing thisSimpleLazyValue
.
-
Method Details
-
get
T get()Gets the value of thisSimpleLazyValue
, computing it if it was not already computed. -
getOptional
Gets anOptional
representing thisSimpleLazyValue
. If the value was not previously loaded, then this simply returns an empty.- Returns:
- the
Optional
representing the value
-