Package rx.functions

Class Actions


  • public final class Actions
    extends java.lang.Object
    Utility class for the Action interfaces.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Actions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T0,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>
      Actions.EmptyAction<T0,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>
      empty()  
      static <T> Action1<T> toAction1​(Action0 action)
      Wraps an Action0 instance into an Action1 instance where the latter calls the former.
      static Func0<java.lang.Void> toFunc​(Action0 action)
      Converts an Action0 to a function that calls the action and returns null.
      static <R> Func0<R> toFunc​(Action0 action, R result)
      Converts an Action0 to a function that calls the action and returns a specified value.
      static <T1> Func1<T1,​java.lang.Void> toFunc​(Action1<T1> action)
      Converts an Action1 to a function that calls the action and returns null.
      static <T1,​R>
      Func1<T1,​R>
      toFunc​(Action1<T1> action, R result)
      Converts an Action1 to a function that calls the action and returns a specified value.
      static <T1,​T2>
      Func2<T1,​T2,​java.lang.Void>
      toFunc​(Action2<T1,​T2> action)
      Converts an Action2 to a function that calls the action and returns null.
      static <T1,​T2,​R>
      Func2<T1,​T2,​R>
      toFunc​(Action2<T1,​T2> action, R result)
      Converts an Action2 to a function that calls the action and returns a specified value.
      static <T1,​T2,​T3>
      Func3<T1,​T2,​T3,​java.lang.Void>
      toFunc​(Action3<T1,​T2,​T3> action)
      Converts an Action3 to a function that calls the action and returns null.
      static <T1,​T2,​T3,​R>
      Func3<T1,​T2,​T3,​R>
      toFunc​(Action3<T1,​T2,​T3> action, R result)
      Converts an Action3 to a function that calls the action and returns a specified value.
      static <T1,​T2,​T3,​T4>
      Func4<T1,​T2,​T3,​T4,​java.lang.Void>
      toFunc​(Action4<T1,​T2,​T3,​T4> action)
      Converts an Action4 to a function that calls the action and returns null.
      static <T1,​T2,​T3,​T4,​R>
      Func4<T1,​T2,​T3,​T4,​R>
      toFunc​(Action4<T1,​T2,​T3,​T4> action, R result)
      Converts an Action4 to a function that calls the action and returns a specified value.
      static <T1,​T2,​T3,​T4,​T5>
      Func5<T1,​T2,​T3,​T4,​T5,​java.lang.Void>
      toFunc​(Action5<T1,​T2,​T3,​T4,​T5> action)
      Converts an Action5 to a function that calls the action and returns null.
      static <T1,​T2,​T3,​T4,​T5,​R>
      Func5<T1,​T2,​T3,​T4,​T5,​R>
      toFunc​(Action5<T1,​T2,​T3,​T4,​T5> action, R result)
      Converts an Action5 to a function that calls the action and returns a specified value.
      static <T1,​T2,​T3,​T4,​T5,​T6>
      Func6<T1,​T2,​T3,​T4,​T5,​T6,​java.lang.Void>
      toFunc​(Action6<T1,​T2,​T3,​T4,​T5,​T6> action)
      Converts an Action6 to a function that calls the action and returns null.
      static <T1,​T2,​T3,​T4,​T5,​T6,​R>
      Func6<T1,​T2,​T3,​T4,​T5,​T6,​R>
      toFunc​(Action6<T1,​T2,​T3,​T4,​T5,​T6> action, R result)
      Converts an Action6 to a function that calls the action and returns a specified value.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7>
      Func7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​java.lang.Void>
      toFunc​(Action7<T1,​T2,​T3,​T4,​T5,​T6,​T7> action)
      Converts an Action7 to a function that calls the action and returns null.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​R>
      Func7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​R>
      toFunc​(Action7<T1,​T2,​T3,​T4,​T5,​T6,​T7> action, R result)
      Converts an Action7 to a function that calls the action and returns a specified value.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>
      Func8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​java.lang.Void>
      toFunc​(Action8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> action)
      Converts an Action8 to a function that calls the action and returns null.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​R>
      Func8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​R>
      toFunc​(Action8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> action, R result)
      Converts an Action8 to a function that calls the action and returns a specified value.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9>
      Func9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​java.lang.Void>
      toFunc​(Action9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9> action)
      Converts an Action9 to a function that calls the action and returns null.
      static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​R>
      Func9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​R>
      toFunc​(Action9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9> action, R result)
      Converts an Action9 to a function that calls the action and returns a specified value.
      static FuncN<java.lang.Void> toFunc​(ActionN action)
      Converts an ActionN to a function that calls the action and returns null.
      static <R> FuncN<R> toFunc​(ActionN action, R result)
      Converts an ActionN to a function that calls the action and returns a specified value.
      • Methods inherited from class java.lang.Object

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

      • Actions

        private Actions()
    • Method Detail

      • empty

        public static <T0,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> Actions.EmptyAction<T0,​T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> empty()
      • toFunc

        public static Func0<java.lang.Void> toFunc​(Action0 action)
        Converts an Action0 to a function that calls the action and returns null.
        Parameters:
        action - the Action0 to convert
        Returns:
        a Func0 that calls action and returns null
      • toFunc

        public static <T1> Func1<T1,​java.lang.Void> toFunc​(Action1<T1> action)
        Converts an Action1 to a function that calls the action and returns null.
        Type Parameters:
        T1 - the first argument type
        Parameters:
        action - the Action1 to convert
        Returns:
        a Func1 that calls action and returns null
      • toFunc

        public static <T1,​T2> Func2<T1,​T2,​java.lang.Void> toFunc​(Action2<T1,​T2> action)
        Converts an Action2 to a function that calls the action and returns null.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        Parameters:
        action - the Action2 to convert
        Returns:
        a Func2 that calls action and returns null
      • toFunc

        public static <T1,​T2,​T3> Func3<T1,​T2,​T3,​java.lang.Void> toFunc​(Action3<T1,​T2,​T3> action)
        Converts an Action3 to a function that calls the action and returns null.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        Parameters:
        action - the Action3 to convert
        Returns:
        a Func3 that calls action and returns null
      • toFunc

        public static <T1,​T2,​T3,​T4> Func4<T1,​T2,​T3,​T4,​java.lang.Void> toFunc​(Action4<T1,​T2,​T3,​T4> action)
        Converts an Action4 to a function that calls the action and returns null.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        Parameters:
        action - the Action4 to convert
        Returns:
        a Func4 that calls action and returns null
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5> Func5<T1,​T2,​T3,​T4,​T5,​java.lang.Void> toFunc​(Action5<T1,​T2,​T3,​T4,​T5> action)
        Converts an Action5 to a function that calls the action and returns null.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        Parameters:
        action - the Action5 to convert
        Returns:
        a Func5 that calls action and returns null
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5,​T6> Func6<T1,​T2,​T3,​T4,​T5,​T6,​java.lang.Void> toFunc​(Action6<T1,​T2,​T3,​T4,​T5,​T6> action)
        Converts an Action6 to a function that calls the action and returns null.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        T6 - the sixth argument type
        Parameters:
        action - the Action6 to convert
        Returns:
        a Func6 that calls action and returns null
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7> Func7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​java.lang.Void> toFunc​(Action7<T1,​T2,​T3,​T4,​T5,​T6,​T7> action)
        Converts an Action7 to a function that calls the action and returns null.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        T6 - the sixth argument type
        T7 - the seventh argument type
        Parameters:
        action - the Action7 to convert
        Returns:
        a Func7 that calls action and returns null
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> Func8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​java.lang.Void> toFunc​(Action8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> action)
        Converts an Action8 to a function that calls the action and returns null.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        T6 - the sixth argument type
        T7 - the seventh argument type
        T8 - the eigth argument type
        Parameters:
        action - the Action8 to convert
        Returns:
        a Func8 that calls action and returns null
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9> Func9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​java.lang.Void> toFunc​(Action9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9> action)
        Converts an Action9 to a function that calls the action and returns null.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        T6 - the sixth argument type
        T7 - the seventh argument type
        T8 - the eigth argument type
        T9 - the ninth argument type
        Parameters:
        action - the Action9 to convert
        Returns:
        a Func9 that calls action and returns null
      • toFunc

        public static FuncN<java.lang.Void> toFunc​(ActionN action)
        Converts an ActionN to a function that calls the action and returns null.
        Parameters:
        action - the ActionN to convert
        Returns:
        a FuncN that calls action and returns null
      • toFunc

        public static <R> Func0<R> toFunc​(Action0 action,
                                          R result)
        Converts an Action0 to a function that calls the action and returns a specified value.
        Type Parameters:
        R - the result type
        Parameters:
        action - the Action0 to convert
        result - the value to return from the function call
        Returns:
        a Func0 that calls action and returns result
      • toFunc

        public static <T1,​R> Func1<T1,​R> toFunc​(Action1<T1> action,
                                                            R result)
        Converts an Action1 to a function that calls the action and returns a specified value.
        Type Parameters:
        T1 - the first argument type
        R - the result type
        Parameters:
        action - the Action1 to convert
        result - the value to return from the function call
        Returns:
        a Func1 that calls action and returns result
      • toFunc

        public static <T1,​T2,​R> Func2<T1,​T2,​R> toFunc​(Action2<T1,​T2> action,
                                                                              R result)
        Converts an Action2 to a function that calls the action and returns a specified value.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        R - the result type
        Parameters:
        action - the Action2 to convert
        result - the value to return from the function call
        Returns:
        a Func2 that calls action and returns result
      • toFunc

        public static <T1,​T2,​T3,​R> Func3<T1,​T2,​T3,​R> toFunc​(Action3<T1,​T2,​T3> action,
                                                                                                R result)
        Converts an Action3 to a function that calls the action and returns a specified value.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        R - the result type
        Parameters:
        action - the Action3 to convert
        result - the value to return from the function call
        Returns:
        a Func3 that calls action and returns result
      • toFunc

        public static <T1,​T2,​T3,​T4,​R> Func4<T1,​T2,​T3,​T4,​R> toFunc​(Action4<T1,​T2,​T3,​T4> action,
                                                                                                                  R result)
        Converts an Action4 to a function that calls the action and returns a specified value.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        R - the result type
        Parameters:
        action - the Action4 to convert
        result - the value to return from the function call
        Returns:
        a Func4 that calls action and returns result
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5,​R> Func5<T1,​T2,​T3,​T4,​T5,​R> toFunc​(Action5<T1,​T2,​T3,​T4,​T5> action,
                                                                                                                                    R result)
        Converts an Action5 to a function that calls the action and returns a specified value.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        R - the result type
        Parameters:
        action - the Action5 to convert
        result - the value to return from the function call
        Returns:
        a Func5 that calls action and returns result
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5,​T6,​R> Func6<T1,​T2,​T3,​T4,​T5,​T6,​R> toFunc​(Action6<T1,​T2,​T3,​T4,​T5,​T6> action,
                                                                                                                                                      R result)
        Converts an Action6 to a function that calls the action and returns a specified value.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        T6 - the sixth argument type
        R - the result type
        Parameters:
        action - the Action6 to convert
        result - the value to return from the function call
        Returns:
        a Func6 that calls action and returns result
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​R> Func7<T1,​T2,​T3,​T4,​T5,​T6,​T7,​R> toFunc​(Action7<T1,​T2,​T3,​T4,​T5,​T6,​T7> action,
                                                                                                                                                                        R result)
        Converts an Action7 to a function that calls the action and returns a specified value.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        T6 - the sixth argument type
        T7 - the seventh argument type
        R - the result type
        Parameters:
        action - the Action7 to convert
        result - the value to return from the function call
        Returns:
        a Func7 that calls action and returns result
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​R> Func8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​R> toFunc​(Action8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> action,
                                                                                                                                                                                          R result)
        Converts an Action8 to a function that calls the action and returns a specified value.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        T6 - the sixth argument type
        T7 - the seventh argument type
        T8 - the eigth argument type
        R - the result type
        Parameters:
        action - the Action8 to convert
        result - the value to return from the function call
        Returns:
        a Func8 that calls action and returns result
      • toFunc

        public static <T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​R> Func9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​R> toFunc​(Action9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9> action,
                                                                                                                                                                                                            R result)
        Converts an Action9 to a function that calls the action and returns a specified value.
        Type Parameters:
        T1 - the first argument type
        T2 - the second argument type
        T3 - the third argument type
        T4 - the fourth argument type
        T5 - the fifth argument type
        T6 - the sixth argument type
        T7 - the seventh argument type
        T8 - the eigth argument type
        T9 - the ninth argument type
        R - the result type
        Parameters:
        action - the Action9 to convert
        result - the value to return from the function call
        Returns:
        a Func9 that calls action and returns result
      • toFunc

        public static <R> FuncN<R> toFunc​(ActionN action,
                                          R result)
        Converts an ActionN to a function that calls the action and returns a specified value.
        Type Parameters:
        R - the result type
        Parameters:
        action - the ActionN to convert
        result - the value to return from the function call
        Returns:
        a FuncN that calls action and returns result
      • toAction1

        public static <T> Action1<T> toAction1​(Action0 action)
        Wraps an Action0 instance into an Action1 instance where the latter calls the former.
        Type Parameters:
        T - the first argument type
        Parameters:
        action - the action to call
        Returns:
        the new Action1 instance