Package rx.functions

Class Actions

java.lang.Object
rx.functions.Actions

public final class Actions extends Object
Utility class for the Action interfaces.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    (package private) static final class 
     
    (package private) static final class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Actions.EmptyAction
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    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>
     
    static <T> Action1<T>
    Wraps an Action0 instance into an Action1 instance where the latter calls the former.
    static Func0<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,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,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,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,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,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,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,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,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,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<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
  • Field Details

  • Constructor Details

    • Actions

      private Actions()
  • Method Details

    • 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<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,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,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,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,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,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,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,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,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,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<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