Class Consumers


  • public final class Consumers
    extends Object
    Utility functions for Consumer.
    • Method Detail

      • curryFirst

        public static <T,​U> Consumer<U> curryFirst​(@Nonnull
                                                         BiConsumer<T,​U> consumer,
                                                         T t)
        Curries the second parameter of the BiConsumer and creates a Consumer.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        Parameters:
        consumer - the consumer
        t - the curried parameter
        Returns:
        the curried consumer
      • currySecond

        public static <T,​U> Consumer<T> currySecond​(@Nonnull
                                                          BiConsumer<T,​U> consumer,
                                                          U u)
        Curries the second parameter of the BiConsumer and creates a Consumer.
        Type Parameters:
        T - the first parameter type
        U - the second parameter type
        Parameters:
        consumer - the consumer
        u - the curried parameter
        Returns:
        the curried consumer
      • reverse

        public static <A,​B> BiConsumer<B,​A> reverse​(@Nonnull
                                                                BiConsumer<A,​B> consumer)
        Reverses the parameter order of the BiConsumer
        Type Parameters:
        A - the first parameter type
        B - the second parameter type
        Parameters:
        consumer - the consumer
        Returns:
        the consumer with switched parameters