Modifier and Type | Method and Description |
---|---|
static <R> BiIntFunction<? extends R> |
safeDefault(@Nullable BiIntFunction<R> func)
Returns a default function if the argument is
null . |
static <T,R> Function<T,? extends R> |
safeDefault(@Nullable Function<T,R> func)
Returns a default function if the argument is
null . |
static <R> IntFunction<? extends R> |
safeDefault(@Nullable IntFunction<R> func)
Returns a default function if the argument is
null . |
static <T> Predicate<T> |
safeToFalse(@Nullable Predicate<T> func) |
static <T> Predicate<T> |
safeToTrue(@Nullable Predicate<T> func) |
public static <T,R> Function<T,? extends 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
otherwisepublic static <R> IntFunction<? extends 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
otherwisepublic static <R> BiIntFunction<? extends R> safeDefault(@Nullable BiIntFunction<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 © 2020. All rights reserved.