Class Tuples

java.lang.Object
reactor.util.function.Tuples
All Implemented Interfaces:
Function

public abstract class Tuples extends Object implements Function
A Tuples is an immutable Collection of objects, each of which can be of an arbitrary type.
Author:
Jon Brisbin, Stephane Maldini
  • Method Details

    • fromArray

      public static Tuple2 fromArray(Object[] list)
      Create a Tuple2 with the given array if it is small enough to fit inside a Tuple2 to Tuple8.
      Parameters:
      list - the content of the Tuple (size 1 to 8)
      Returns:
      The new Tuple2.
      Throws:
      IllegalArgumentException - if the array is not of length 1-8
    • of

      public static <T1, T2> Tuple2<T1,T2> of(T1 t1, T2 t2)
      Create a Tuple2 with the given objects.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      Parameters:
      t1 - The first value in the tuple. Not null.
      t2 - The second value in the tuple. Not null.
      Returns:
      The new Tuple2.
    • of

      public static <T1, T2, T3> Tuple3<T1,T2,T3> of(T1 t1, T2 t2, T3 t3)
      Create a Tuple3 with the given objects.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      Parameters:
      t1 - The first value in the tuple. Not null.
      t2 - The second value in the tuple. Not null.
      t3 - The third value in the tuple. Not null.
      Returns:
      The new Tuple3.
    • of

      public static <T1, T2, T3, T4> Tuple4<T1,T2,T3,T4> of(T1 t1, T2 t2, T3 t3, T4 t4)
      Create a Tuple4 with the given objects.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      Parameters:
      t1 - The first value in the tuple. Not null.
      t2 - The second value in the tuple. Not null.
      t3 - The third value in the tuple. Not null.
      t4 - The fourth value in the tuple. Not null.
      Returns:
      The new Tuple4.
    • of

      public static <T1, T2, T3, T4, T5> Tuple5<T1,T2,T3,T4,T5> of(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
      Create a Tuple5 with the given objects.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      Parameters:
      t1 - The first value in the tuple. Not null.
      t2 - The second value in the tuple. Not null.
      t3 - The third value in the tuple. Not null.
      t4 - The fourth value in the tuple. Not null.
      t5 - The fifth value in the tuple. Not null.
      Returns:
      The new Tuple5.
    • of

      public static <T1, T2, T3, T4, T5, T6> Tuple6<T1,T2,T3,T4,T5,T6> of(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
      Create a Tuple6 with the given objects.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      T6 - The type of the sixth value.
      Parameters:
      t1 - The first value in the tuple. Not null.
      t2 - The second value in the tuple. Not null.
      t3 - The third value in the tuple. Not null.
      t4 - The fourth value in the tuple. Not null.
      t5 - The fifth value in the tuple. Not null.
      t6 - The sixth value in the tuple. Not null.
      Returns:
      The new Tuple6.
    • of

      public static <T1, T2, T3, T4, T5, T6, T7> Tuple7<T1,T2,T3,T4,T5,T6,T7> of(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7)
      Create a Tuple7 with the given objects.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      T6 - The type of the sixth value.
      T7 - The type of the seventh value.
      Parameters:
      t1 - The first value in the tuple. Not null.
      t2 - The second value in the tuple. Not null.
      t3 - The third value in the tuple. Not null.
      t4 - The fourth value in the tuple. Not null.
      t5 - The fifth value in the tuple. Not null.
      t6 - The sixth value in the tuple. Not null.
      t7 - The seventh value in the tuple. Not null.
      Returns:
      The new Tuple7.
    • of

      public static <T1, T2, T3, T4, T5, T6, T7, T8> Tuple8<T1,T2,T3,T4,T5,T6,T7,T8> of(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8)
      Create a Tuple8 with the given objects.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      T6 - The type of the sixth value.
      T7 - The type of the seventh value.
      T8 - The type of the eighth value.
      Parameters:
      t1 - The first value in the tuple. Not Null.
      t2 - The second value in the tuple.Not Null.
      t3 - The third value in the tuple. Not Null.
      t4 - The fourth value in the tuple. Not Null.
      t5 - The fifth value in the tuple. Not Null.
      t6 - The sixth value in the tuple. Not Null.
      t7 - The seventh value in the tuple. Not Null.
      t8 - The eighth value in the tuple. Not Null.
      Returns:
      The new Tuple8.
    • fnAny

      public static Function<Object[],Tuple2> fnAny()
      A converting function from Object array to Tuples
      Returns:
      The unchecked conversion function to Tuples.
    • fnAny

      public static <R> Function<Object[],R> fnAny(Function<Tuple2,R> delegate)
      A converting function from Object array to Tuples to R.
      Type Parameters:
      R - The type of the return value.
      Parameters:
      delegate - the function to delegate to
      Returns:
      The unchecked conversion function to R.
    • fn2

      public static <T1, T2> Function<Object[],Tuple2<T1,T2>> fn2()
      A converting function from Object array to Tuple2
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      Returns:
      The unchecked conversion function to Tuple2.
    • fn3

      public static <T1, T2, T3> Function<Object[],Tuple3<T1,T2,T3>> fn3()
      A converting function from Object array to Tuple3
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      Returns:
      The unchecked conversion function to Tuple3.
    • fn3

      public static <T1, T2, T3, R> Function<Object[],R> fn3(Function<Tuple3<T1,T2,T3>,R> delegate)
      A converting function from Object array to Tuple3 to R.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      R - The type of the return value.
      Parameters:
      delegate - the function to delegate to
      Returns:
      The unchecked conversion function to R.
    • fn4

      public static <T1, T2, T3, T4> Function<Object[],Tuple4<T1,T2,T3,T4>> fn4()
      A converting function from Object array to Tuple4
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      Returns:
      The unchecked conversion function to Tuple4.
    • fn4

      public static <T1, T2, T3, T4, R> Function<Object[],R> fn4(Function<Tuple4<T1,T2,T3,T4>,R> delegate)
      A converting function from Object array to Tuple4 to R.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      R - The type of the return value.
      Parameters:
      delegate - the function to delegate to
      Returns:
      The unchecked conversion function to R.
    • fn5

      public static <T1, T2, T3, T4, T5> Function<Object[],Tuple5<T1,T2,T3,T4,T5>> fn5()
      A converting function from Object array to Tuple5
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      Returns:
      The unchecked conversion function to Tuple5.
    • fn5

      public static <T1, T2, T3, T4, T5, R> Function<Object[],R> fn5(Function<Tuple5<T1,T2,T3,T4,T5>,R> delegate)
      A converting function from Object array to Tuple4 to R.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      R - The type of the return value.
      Parameters:
      delegate - the function to delegate to
      Returns:
      The unchecked conversion function to R.
    • fn6

      public static <T1, T2, T3, T4, T5, T6> Function<Object[],Tuple6<T1,T2,T3,T4,T5,T6>> fn6()
      A converting function from Object array to Tuple6
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      T6 - The type of the sixth value.
      Returns:
      The unchecked conversion function to Tuple6.
    • fn6

      public static <T1, T2, T3, T4, T5, T6, R> Function<Object[],R> fn6(Function<Tuple6<T1,T2,T3,T4,T5,T6>,R> delegate)
      A converting function from Object array to Tuple6 to R.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      T6 - The type of the sixth value.
      R - The type of the return value.
      Parameters:
      delegate - the function to delegate to
      Returns:
      The unchecked conversion function to R.
    • fn7

      public static <T1, T2, T3, T4, T5, T6, T7> Function<Object[],Tuple7<T1,T2,T3,T4,T5,T6,T7>> fn7()
      A converting function from Object array to Tuple7
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      T6 - The type of the sixth value.
      T7 - The type of the seventh value.
      Returns:
      The unchecked conversion function to Tuple7.
    • fn7

      public static <T1, T2, T3, T4, T5, T6, T7, R> Function<Object[],R> fn7(Function<Tuple7<T1,T2,T3,T4,T5,T6,T7>,R> delegate)
      A converting function from Object array to Tuple7 to R.
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      T6 - The type of the sixth value.
      T7 - The type of the seventh value.
      R - The type of the return value.
      Parameters:
      delegate - the function to delegate to
      Returns:
      The unchecked conversion function to R.
    • fn8

      public static <T1, T2, T3, T4, T5, T6, T7, T8> Function<Object[],Tuple8<T1,T2,T3,T4,T5,T6,T7,T8>> fn8()
      A converting function from Object array to Tuple8
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      T6 - The type of the sixth value.
      T7 - The type of the seventh value.
      T8 - The type of the eighth value.
      Returns:
      The unchecked conversion function to Tuple8.
    • fn8

      public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Function<Object[],R> fn8(Function<Tuple8<T1,T2,T3,T4,T5,T6,T7,T8>,R> delegate)
      A converting function from Object array to Tuple8
      Type Parameters:
      T1 - The type of the first value.
      T2 - The type of the second value.
      T3 - The type of the third value.
      T4 - The type of the fourth value.
      T5 - The type of the fifth value.
      T6 - The type of the sixth value.
      T7 - The type of the seventh value.
      T8 - The type of the eighth value.
      R - The type of the return value.
      Parameters:
      delegate - the function to delegate to
      Returns:
      The unchecked conversion function to Tuple8.
    • apply

      public Tuple2 apply(Object o)
      Specified by:
      apply in interface Function