public interface Lazy<R>
extends java.util.concurrent.Callable<R>
Modifier and Type | Method and Description |
---|---|
default Thunk<R> |
asThunk()
Tell if this is really a
Thunk |
R |
call()
Compute the value if it is needed.
|
default boolean |
isShared()
Tell if this is shared.
|
R call()
Compute the value if it is needed.
call
in interface java.util.concurrent.Callable<R>
Callable.call()
default boolean isShared()
Tell if this is shared.
Data and functions whose call()
method returns this as well
as simple boxes that just hold a value ready to be supplied and Thunk
s
are considered shared.
But a bare lambda expression is assumed to be in need of sharing. For example:
() -> 42