public abstract class LazyValue<T> extends Object implements Supplier<T>
T.
LazyValue implements an evaluate by need semantics:
createValue() is called exactly once when get()
is called for the first time.
LazyValue instances are thread safe.
| Constructor and Description |
|---|
LazyValue() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
createValue()
Factory method called to create the value on an as need basis.
|
T |
get()
Get value.
|
boolean |
hasValue() |
protected abstract T createValue()
T.public boolean hasValue()
true iff get() has been called at least once.public T get()
createValue() if called for the first time.Copyright © 2012–2020 The Apache Software Foundation. All rights reserved.