Class FunctionalAction


  • public class FunctionalAction
    extends java.lang.Object
    Utility methods for performing a functional operation.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T,​X extends java.lang.Exception>
      void
      perform​(ThrowingConsumer<T,​X> action, T input, java.lang.Class<X> exceptionClass)
      Perform a ThrowingConsumer operation that accepts a single input argument and returns no result.
      static <T1,​T2,​T3,​X extends java.lang.Exception>
      void
      perform​(ThrowingConsumer3<? super T1,​? super T2,​? super T3,​X> action, T1 input1, T2 input2, T3 input3, java.lang.Class<X> exceptionClass)
      Perform a ThrowingConsumer3 operation that accepts three input arguments and returns no result.
      static <T,​U>
      void
      perform​(java.util.function.BiConsumer<T,​U> action, T input1, U input2)
      Perform a BiConsumer operation that accepts two input arguments and returns no result.
      static <T> void perform​(java.util.function.Consumer<? super T> action, T input)
      Perform a Consumer operation that accepts a single input argument and returns no result.
      static <K,​V,​R>
      R
      performBiFunc​(java.util.function.BiFunction<? super K,​? super V,​? extends R> action, K input1, V input2)
      Perform a BiFunction operation that accepts two argument and produces a result.
      static <T,​R>
      R
      performFunc​(java.util.function.Function<? super T,​? extends R> action, T input)
      Perform a Function operation that accepts one argument and produces a result.
      static <T,​X extends java.lang.Exception>
      T
      performGet​(ThrowingSupplier<T,​X> action, java.lang.Class<X> exceptionClass)
      Perform a ThrowingSupplier operation that accepts no argument and returns one result.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • perform

        public static <T> void perform​(java.util.function.Consumer<? super T> action,
                                       T input)
        Perform a Consumer operation that accepts a single input argument and returns no result.
        Type Parameters:
        T - the type of the input to the Consumer operation
      • performGet

        public static <T,​X extends java.lang.Exception> T performGet​(ThrowingSupplier<T,​X> action,
                                                                           java.lang.Class<X> exceptionClass)
                                                                    throws X extends java.lang.Exception
        Perform a ThrowingSupplier operation that accepts no argument and returns one result.
        Type Parameters:
        T - the type of the output to the ThrowingSupplier operation
        X - the type of exception could be thrown from the ThrowingSupplier operation
        Throws:
        X extends java.lang.Exception
      • perform

        public static <T,​X extends java.lang.Exception> void perform​(ThrowingConsumer<T,​X> action,
                                                                           T input,
                                                                           java.lang.Class<X> exceptionClass)
                                                                    throws X extends java.lang.Exception
        Perform a ThrowingConsumer operation that accepts a single input argument and returns no result.
        Type Parameters:
        T - the type of the input to the ThrowingConsumer operation
        X - the type of exception could be thrown from the ThrowingConsumer operation
        Throws:
        X extends java.lang.Exception
      • perform

        public static <T,​U> void perform​(java.util.function.BiConsumer<T,​U> action,
                                               T input1,
                                               U input2)
        Perform a BiConsumer operation that accepts two input arguments and returns no result.
        Type Parameters:
        T - the type of the first input to the BiConsumer operation
        U - the type of the second input to the BiConsumer operation
      • perform

        public static <T1,​T2,​T3,​X extends java.lang.Exception> void perform​(ThrowingConsumer3<? super T1,​? super T2,​? super T3,​X> action,
                                                                                              T1 input1,
                                                                                              T2 input2,
                                                                                              T3 input3,
                                                                                              java.lang.Class<X> exceptionClass)
                                                                                       throws X extends java.lang.Exception
        Perform a ThrowingConsumer3 operation that accepts three input arguments and returns no result.
        Type Parameters:
        T1 - the type of the first input to the ThrowingConsumer3 operation
        T2 - the type of the second input to the ThrowingConsumer3 operation
        T3 - the type of the third input to the ThrowingConsumer3 operation
        X - the type of exception could be thrown from the ThrowingConsumer3 operation
        Throws:
        X extends java.lang.Exception
      • performFunc

        public static <T,​R> R performFunc​(java.util.function.Function<? super T,​? extends R> action,
                                                T input)
        Perform a Function operation that accepts one argument and produces a result.
        Type Parameters:
        T - the type of the input
        R - the type of the result
      • performBiFunc

        public static <K,​V,​R> R performBiFunc​(java.util.function.BiFunction<? super K,​? super V,​? extends R> action,
                                                          K input1,
                                                          V input2)
        Perform a BiFunction operation that accepts two argument and produces a result.
        Type Parameters:
        K - the type of the first input
        V - the type of the second input
        R - the type of the result