Class Lazy<T>
java.lang.Object
com.github.mizool.core.concurrent.Lazy<T>
- All Implemented Interfaces:
Supplier<T>
A value container where the value is lazily obtained from the given
There is at most one call to the
This means that
Supplier
on the first get()
call. All subsequent get()
calls will return the same value.There is at most one call to the
Supplier
. The state whether the Supplier
was called in the
past is stored within the Lazy
instance.This means that
null
is handled transparently: if the Supplier
returns null
, the Lazy
instance will return null
for all subsequent calls of get()
as well.
This class only handles the value. Exceptions thrown by the Supplier
are simply passed on and the internal
state of Lazy
does not change.-
Constructor Summary
Constructors -
Method Summary