R
- the result typepublic static final class LambdaSafe.InvocationResult<R> extends Object
null
or absent entirely if
the callback wasn't suitable. Similar in design to Optional
but allows for
null
as a valid value.Modifier and Type | Method and Description |
---|---|
R |
get()
Return the result of the invocation or
null if the callback wasn't
suitable. |
R |
get(R fallback)
Return the result of the invocation or the given fallback if the callback
wasn't suitable.
|
boolean |
hasResult()
Return true if a result in present.
|
static <R> LambdaSafe.InvocationResult<R> |
noResult()
Return an
LambdaSafe.InvocationResult instance representing no result. |
static <R> LambdaSafe.InvocationResult<R> |
of(R value)
Create a new
LambdaSafe.InvocationResult instance with the specified value. |
public boolean hasResult()
public R get()
null
if the callback wasn't
suitable.null
public R get(R fallback)
fallback
- the fallback to use when there is no resultpublic static <R> LambdaSafe.InvocationResult<R> of(R value)
LambdaSafe.InvocationResult
instance with the specified value.R
- the result typevalue
- the value (may be null
)LambdaSafe.InvocationResult
public static <R> LambdaSafe.InvocationResult<R> noResult()
LambdaSafe.InvocationResult
instance representing no result.R
- the result typeLambdaSafe.InvocationResult
Copyright © 2020 Pivotal Software, Inc.. All rights reserved.