Package ratpack.func

Interface BiAction<T,​U>

  • Type Parameters:
    T - the type of the first thing
    U - The type of the second thing
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface BiAction<T,​U>
    A generic type for an object that does some work with 2 input things.

    This type serves the same purpose as the JDK's BiConsumer, but allows throwing checked exceptions. It contains methods for bridging to and from the JDK type.

    • Method Detail

      • execute

        void execute​(T t,
                     U u)
              throws Exception
        Executes the action against the given thing.
        Parameters:
        t - the first thing to input to the action
        u - the second thing to input to the action
        Throws:
        Exception - if anything goes wrong
      • noop

        static <T,​U> BiAction<T,​U> noop()
        Returns a bi-action that does precisely nothing.
        Type Parameters:
        T - the type of the first thing
        U - The type of the second thing
        Returns:
        a bi-action that does precisely nothing
        Since:
        1.5
      • from

        static <T,​U> BiAction<T,​U> from​(BiConsumer<T,​U> consumer)
        Creates an bi-action from a JDK bi-consumer.
        Type Parameters:
        T - the type of the first object this action accepts
        U - the type of the second object this action accepts
        Parameters:
        consumer - the JDK consumer
        Returns:
        the given consumer as an action