public class Lazy<T> extends Object implements Supplier<T>
Supplier returning the produced object for
subsequent lookups. Note, that no concurrency control is applied during the lookup of get(), which means in
concurrent access scenarios, the provided Supplier can be called multiple times.| Constructor and Description |
|---|
Lazy() |
| Modifier and Type | Method and Description |
|---|---|
<S> Lazy<S> |
flatMap(Function<T,Lazy<S>> function)
|
T |
get()
Returns the value created by the configured
Supplier. |
<S> Lazy<S> |
map(Function<T,S> function)
|
static <T> Lazy<T> |
of(Supplier<T> supplier)
Creates a new
Lazy to produce an object lazily. |
public static <T> Lazy<T> of(Supplier<T> supplier)
Lazy to produce an object lazily.T - the type of which to produce an object of eventually.supplier - the Supplier to create the object lazily.public T get()
Supplier. Will return the calculated instance for subsequent
lookups.public <S> Lazy<S> map(Function<T,S> function)
function - must not be null.Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.