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(RunnableWithException command, T result)static <T> java.util.function.Consumer<T>ignoreFn()Consumer which ignores the input.static <T> java.util.function.Function<T,Void>nullFn()Function which returnsnull(type: Void).static <A> java.util.function.Consumer<A>uncheckedConsumer(ThrowingConsumer<A,?> throwingConsumer)Converts aThrowingConsumerinto aConsumerwhich throws checked exceptions as unchecked.static <A,B>
java.util.function.Function<A,B>uncheckedFunction(FunctionWithException<A,B,?> functionWithException)Convert atFunctionWithExceptioninto aFunction.static <T> java.util.function.Supplier<T>uncheckedSupplier(SupplierWithException<T,?> supplierWithException)Converts aSupplierWithExceptioninto aSupplierwhich throws all checked exceptions as unchecked.
-
-
-
Method Detail
-
nullFn
public static <T> java.util.function.Function<T,Void> nullFn()
Function which returnsnull(type: Void).- Type Parameters:
T- input type- Returns:
- Function which returns
null.
-
ignoreFn
public static <T> java.util.function.Consumer<T> ignoreFn()
Consumer which ignores the input.- Type Parameters:
T- type of the input- Returns:
- Ignoring
Consumer
-
uncheckedFunction
public static <A,B> java.util.function.Function<A,B> uncheckedFunction(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> java.util.function.Consumer<A> uncheckedConsumer(ThrowingConsumer<A,?> throwingConsumer)
Converts aThrowingConsumerinto aConsumerwhich throws checked exceptions as unchecked.- Type Parameters:
A- input type- Parameters:
throwingConsumer- to convert into aConsumer- Returns:
Consumerwhich throws all checked exceptions as unchecked
-
uncheckedSupplier
public static <T> java.util.function.Supplier<T> uncheckedSupplier(SupplierWithException<T,?> supplierWithException)
Converts aSupplierWithExceptioninto aSupplierwhich throws all checked exceptions as unchecked.- Parameters:
supplierWithException- to convert into aSupplier- Returns:
Supplierwhich throws all checked exceptions as unchecked.
-
asCallable
public static <T> Callable<T> asCallable(RunnableWithException command, T result)
-
-