@Deprecated public class Lazy<T> extends Object implements Supplier<T>
Supplier that provides a virtually fixed value.
This value is only actually determined when it is accessed for the first time.
This implementation ensures that the originally defined initialization code
is called at most once, even if there is concurrent access from multiple threads, unless the
initialization attempt causes a RuntimeException.
Once the value is established, unnecessary effort to synchronize competing accesses is avoided.
| Constructor and Description |
|---|
Lazy(Supplier<T> initial)
Deprecated.
Initializes a new instance giving a supplier that defines the intended initialization of the
represented value.
|
| Modifier and Type | Method and Description |
|---|---|
T |
get()
Deprecated.
Executes the originally defined initialization code on the first call and
returns its result on that and every subsequent call without calling the supplier again.
|
public final T get()
Copyright © 2023 Andreas Kluge-Kaindl, Bremen (de). All rights reserved.