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.| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canEqual(Object other) |
boolean |
equals(Object o) |
<S> Lazy<S> |
flatMap(Function<T,Lazy<S>> function)
|
T |
get()
Returns the value created by the configured
Supplier. |
int |
hashCode() |
<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. |
T |
orElse(T value)
Returns the value of the lazy computation or the given default value in case the computation yields
null.
|
T |
orElseGet(Supplier<T> supplier)
Returns the value of the lazy computation or the value produced by the given
Supplier in case the original
value is null. |
@ConstructorProperties(value="supplier") @Generated(value="lombok") public Lazy(Supplier<T> supplier)
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.@Nullable public T orElse(@Nullable T value)
value - @Nullable public T orElseGet(Supplier<T> supplier)
Supplier in case the original
value is null.supplier - must not be null.public <S> Lazy<S> map(Function<T,S> function)
function - must not be null.public <S> Lazy<S> flatMap(Function<T,Lazy<S>> function)
function - must not be null.@Generated(value="lombok") public boolean equals(Object o)
@Generated(value="lombok") protected boolean canEqual(Object other)
@Generated(value="lombok") public int hashCode()
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.