Modifier and Type | Method and Description |
---|---|
static <T,R> Function<T,R> |
safeDefault(Function<T,R> func)
Returns a default function if the argument is
null . |
static <R> IntFunction<R> |
safeDefault(IntFunction<R> func)
Returns a default function if the argument is
null . |
@Nonnull public static <T,R> Function<T,R> safeDefault(@Nullable Function<T,R> func)
null
. The default function's
Function#apply(Object) apply
method will always return null
.
If a non-null
function is passed to this method, it is returned as-is.func
- the function reference (may be null
)null
object identical to the passed function, if it is
non-null
, or a function object always returning null
otherwise@Nonnull public static <R> IntFunction<R> safeDefault(@Nullable IntFunction<R> func)
null
. The default function's
apply
method will always return null
.
If a non-null
function is passed to this method, it is returned as-is.func
- the function reference (may be null
)null
object identical to the passed function, if it is
non-null
, or a function object always returning null
otherwiseCopyright © 2015. All rights reserved.