Class Funcs


  • public final class Funcs
    extends Object
    The type Funcs.
    Author:
    David B. Bracewell
    • Method Detail

      • literal

        public static <T,​R> Function<T,​R> literal​(R returnValue)
      • instanceOf

        public static <T> Predicate<T> instanceOf​(Class<?> clazz)
      • asConsumer

        public static <T> Consumer<T> asConsumer​(Function<? super T,​?> function)
        As consumer consumer.
        Type Parameters:
        T - the type parameter
        Parameters:
        function - the function
        Returns:
        the consumer
      • asFunction

        public static <T,​R> Function<T,​R> asFunction​(Consumer<? super T> consumer,
                                                                 R returnValue)
        As function function.
        Type Parameters:
        T - the type parameter
        R - the type parameter
        Parameters:
        consumer - the consumer
        returnValue - the return value
        Returns:
        the function
      • asFunction

        public static <T,​R> Function<T,​R> asFunction​(Consumer<? super T> consumer)
        As function function.
        Type Parameters:
        T - the type parameter
        R - the type parameter
        Parameters:
        consumer - the consumer
        Returns:
        the function
      • when

        public static <I,​O> Funcs.When<I,​O> when​(SerializablePredicate<? super I> predicate,
                                                             SerializableFunction<? super I,​? extends O> trueAction)
        When when.
        Type Parameters:
        I - the type parameter
        O - the type parameter
        Parameters:
        predicate - the predicate
        trueAction - the true action
        Returns:
        the when
      • when

        public static <I,​O> Funcs.When<I,​O> when​(SerializablePredicate<? super I> predicate,
                                                             O trueValue)
        When when.
        Type Parameters:
        I - the type parameter
        O - the type parameter
        Parameters:
        predicate - the predicate
        trueValue - the true value
        Returns:
        the when