public final class Functions extends Object
Function- and FunctionWhichThrows-related utility methods.| Modifier and Type | Method and Description |
|---|---|
static <I,O,EX extends RuntimeException> |
asFunction(FunctionWhichThrows<? super I,? extends O,EX> source)
Converts a
FunctionWhichThrows into a Function. |
static <I,O,EX extends Throwable> |
asFunctionWhichThrows(Function<? super I,? extends O> source)
Converts a
Function into a FunctionWhichThrows. |
static <O,I extends O> |
identity() |
static <I,O,EX extends Throwable> |
ignoreExceptions(Class<EX> exceptionClass,
FunctionWhichThrows<I,O,EX> delegate,
O defaultValue)
Wraps the delegate such that its declared exception is caught, ignored, and the
defaultValue is returned.
|
public static <O,I extends O> Function<I,O> identity()
Function that transforms any object reference to itself.public static <I,O,EX extends Throwable> FunctionWhichThrows<I,O,EX> asFunctionWhichThrows(Function<? super I,? extends O> source)
Function into a FunctionWhichThrows.
That is possible iff:
I - The functions' input typeO - The functions' output typeEX - The target function's exceptionpublic static <I,O,EX extends RuntimeException> Function<I,O> asFunction(FunctionWhichThrows<? super I,? extends O,EX> source)
FunctionWhichThrows into a Function.
That is possible iff:
RuntimeException.
I - The functions' input typeO - The functions' output typeEX - The source function's exceptionpublic static <I,O,EX extends Throwable> Function<I,O> ignoreExceptions(Class<EX> exceptionClass, FunctionWhichThrows<I,O,EX> delegate, @Nullable O defaultValue)
Copyright © 2018 Arno Unkrig. All rights reserved.