- Type Parameters:
T - type of wrapped value
public class LazyValue<T>
extends Object
Wrapper for a value that should only be lazily initialised when being accessed for the first time.
-
Constructor Summary
Constructors
Constructor, not yet invoking the given
Supplier.
-
Method Summary
Look-up the wrapped value, loading it on first invocation.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
LazyValue
public LazyValue(Supplier<? extends T> supplier)
Constructor, not yet invoking the given
Supplier.
- Parameters:
supplier - value look-up to be performed the first time get() is being called
-
Method Details
-
get
Look-up the wrapped value, loading it on first invocation.
- Returns:
- wrapped value