Package org.apache.flink.util.function
Class FunctionUtils
- java.lang.Object
-
- org.apache.flink.util.function.FunctionUtils
-
public class FunctionUtils extends Object
Utility class for Flink's functions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Callable<T>asCallable(org.apache.flink.util.function.RunnableWithException command, T result)static <T> Consumer<T>ignoreFn()Consumer which ignores the input.static <T> Function<T,Void>nullFn()Function which returnsnull(type: Void).static <A> Consumer<A>uncheckedConsumer(org.apache.flink.util.function.ThrowingConsumer<A,?> throwingConsumer)Converts aThrowingConsumerinto aConsumerwhich throws checked exceptions as unchecked.static <A,B>
Function<A,B>uncheckedFunction(org.apache.flink.util.function.FunctionWithException<A,B,?> functionWithException)Convert atFunctionWithExceptioninto aFunction.static <T> Supplier<T>uncheckedSupplier(org.apache.flink.util.function.SupplierWithException<T,?> supplierWithException)Converts aSupplierWithExceptioninto aSupplierwhich throws all checked exceptions as unchecked.
-
-
-
Method Detail
-
nullFn
public static <T> Function<T,Void> nullFn()
Function which returnsnull(type: Void).- Type Parameters:
T- input type- Returns:
- Function which returns
null.
-
ignoreFn
public static <T> Consumer<T> ignoreFn()
Consumer which ignores the input.- Type Parameters:
T- type of the input- Returns:
- Ignoring
Consumer
-
uncheckedFunction
public static <A,B> Function<A,B> uncheckedFunction(org.apache.flink.util.function.FunctionWithException<A,B,?> functionWithException)
Convert atFunctionWithExceptioninto aFunction.- Type Parameters:
A- input typeB- output type- Parameters:
functionWithException- function with exception to convert into a function- Returns:
Functionwhich throws all checked exception as an unchecked exception.
-
uncheckedConsumer
public static <A> Consumer<A> uncheckedConsumer(org.apache.flink.util.function.ThrowingConsumer<A,?> throwingConsumer)
Converts aThrowingConsumerinto aConsumerwhich throws checked exceptions as unchecked.
-
uncheckedSupplier
public static <T> Supplier<T> uncheckedSupplier(org.apache.flink.util.function.SupplierWithException<T,?> supplierWithException)
Converts aSupplierWithExceptioninto aSupplierwhich throws all checked exceptions as unchecked.
-
asCallable
public static <T> Callable<T> asCallable(org.apache.flink.util.function.RunnableWithException command, T result)
-
-