Class FunctionUtils


  • public class FunctionUtils
    extends Object
    Utility class for Flink's functions.
    • Method Detail

      • nullFn

        public static <T> Function<T,​Void> nullFn()
        Function which returns null (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 at FunctionWithException into a Function.
        Type Parameters:
        A - input type
        B - output type
        Parameters:
        functionWithException - function with exception to convert into a function
        Returns:
        Function which throws all checked exception as an unchecked exception.
      • uncheckedConsumer

        public static <A> Consumer<A> uncheckedConsumer​(org.apache.flink.util.function.ThrowingConsumer<A,​?> throwingConsumer)
        Converts a ThrowingConsumer into a Consumer which throws checked exceptions as unchecked.
        Type Parameters:
        A - input type
        Parameters:
        throwingConsumer - to convert into a Consumer
        Returns:
        Consumer which throws all checked exceptions as unchecked
      • uncheckedSupplier

        public static <T> Supplier<T> uncheckedSupplier​(org.apache.flink.util.function.SupplierWithException<T,​?> supplierWithException)
        Converts a SupplierWithException into a Supplier which throws all checked exceptions as unchecked.
        Parameters:
        supplierWithException - to convert into a Supplier
        Returns:
        Supplier which throws all checked exceptions as unchecked.
      • asCallable

        public static <T> Callable<T> asCallable​(org.apache.flink.util.function.RunnableWithException command,
                                                 T result)
        Converts RunnableWithException into a Callable that will return the result.