Package groovy.lang

Class Tuple<E>

All Implemented Interfaces:
Serializable, Cloneable, Comparable<Tuple<E>>, Iterable<E>, Collection<E>, List<E>
Direct Known Subclasses:
Tuple0, Tuple1, Tuple10, Tuple11, Tuple12, Tuple13, Tuple14, Tuple15, Tuple16, Tuple2, Tuple3, Tuple4, Tuple5, Tuple6, Tuple7, Tuple8, Tuple9

public class Tuple<E>
extends AbstractList<E>
implements Serializable, Cloneable, Comparable<Tuple<E>>
Represents a list of Objects.
See Also:
Serialized Form
  • Field Summary

    Fields inherited from class java.util.AbstractList

    modCount
  • Constructor Summary

    Constructors 
    Constructor Description
    Tuple​(E... contents)  
    Tuple​(Tuple<E> tuple)  
  • Method Summary

    Modifier and Type Method Description
    Tuple<E> clone()  
    int compareTo​(Tuple<E> other)  
    boolean equals​(Object o)  
    E get​(int index)  
    int hashCode()  
    int size()  
    List<E> subList​(int fromIndex, int toIndex)  
    Tuple<E> subTuple​(int fromIndex, int toIndex)  
    E[] toArray()  
    static Tuple0 tuple()
    Construct a tuple of degree 0.
    static <T1> Tuple1<T1> tuple​(T1 v1)
    Construct a tuple of degree 1.
    static <T1,​ T2> Tuple2<T1,​T2> tuple​(T1 v1, T2 v2)
    Construct a tuple of degree 2.
    static <T1,​ T2,​ T3> Tuple3<T1,​T2,​T3> tuple​(T1 v1, T2 v2, T3 v3)
    Construct a tuple of degree 3.
    static <T1,​ T2,​ T3,​ T4>
    Tuple4<T1,​T2,​T3,​T4>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4)
    Construct a tuple of degree 4.
    static <T1,​ T2,​ T3,​ T4,​ T5>
    Tuple5<T1,​T2,​T3,​T4,​T5>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5)
    Construct a tuple of degree 5.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6>
    Tuple6<T1,​T2,​T3,​T4,​T5,​T6>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6)
    Construct a tuple of degree 6.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7>
    Tuple7<T1,​T2,​T3,​T4,​T5,​T6,​T7>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7)
    Construct a tuple of degree 7.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8>
    Tuple8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8)
    Construct a tuple of degree 8.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9>
    Tuple9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9)
    Construct a tuple of degree 9.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10>
    Tuple10<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10)
    Construct a tuple of degree 10.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11>
    Tuple11<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11)
    Construct a tuple of degree 11.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12>
    Tuple12<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12)
    Construct a tuple of degree 12.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12,​ T13>
    Tuple13<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13)
    Construct a tuple of degree 13.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12,​ T13,​ T14>
    Tuple14<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14)
    Construct a tuple of degree 14.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12,​ T13,​ T14,​ T15>
    Tuple15<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15)
    Construct a tuple of degree 15.
    static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12,​ T13,​ T14,​ T15,​ T16>
    Tuple16<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16>
    tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16)
    Construct a tuple of degree 16.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface java.util.Collection

    parallelStream, removeIf, stream, toArray

    Methods inherited from interface java.lang.Iterable

    forEach

    Methods inherited from interface java.util.List

    addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray
  • Constructor Details

  • Method Details

    • get

      public E get​(int index)
      Specified by:
      get in interface List<E>
      Specified by:
      get in class AbstractList<E>
    • size

      public int size()
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface List<E>
      Specified by:
      size in class AbstractCollection<E>
    • toArray

      public E[] toArray()
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface List<E>
      Overrides:
      toArray in class AbstractCollection<E>
    • subList

      public List<E> subList​(int fromIndex, int toIndex)
      Specified by:
      subList in interface List<E>
      Overrides:
      subList in class AbstractList<E>
    • subTuple

      public Tuple<E> subTuple​(int fromIndex, int toIndex)
    • equals

      public boolean equals​(Object o)
      Specified by:
      equals in interface Collection<E>
      Specified by:
      equals in interface List<E>
      Overrides:
      equals in class AbstractList<E>
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<E>
      Specified by:
      hashCode in interface List<E>
      Overrides:
      hashCode in class AbstractList<E>
    • compareTo

      public int compareTo​(Tuple<E> other)
      Specified by:
      compareTo in interface Comparable<E>
    • tuple

      public static Tuple0 tuple()
      Construct a tuple of degree 0.
    • tuple

      public static <T1> Tuple1<T1> tuple​(T1 v1)
      Construct a tuple of degree 1.
    • tuple

      public static <T1,​ T2> Tuple2<T1,​T2> tuple​(T1 v1, T2 v2)
      Construct a tuple of degree 2.
    • tuple

      public static <T1,​ T2,​ T3> Tuple3<T1,​T2,​T3> tuple​(T1 v1, T2 v2, T3 v3)
      Construct a tuple of degree 3.
    • tuple

      public static <T1,​ T2,​ T3,​ T4> Tuple4<T1,​T2,​T3,​T4> tuple​(T1 v1, T2 v2, T3 v3, T4 v4)
      Construct a tuple of degree 4.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5> Tuple5<T1,​T2,​T3,​T4,​T5> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5)
      Construct a tuple of degree 5.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6> Tuple6<T1,​T2,​T3,​T4,​T5,​T6> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6)
      Construct a tuple of degree 6.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7> Tuple7<T1,​T2,​T3,​T4,​T5,​T6,​T7> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7)
      Construct a tuple of degree 7.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8> Tuple8<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8)
      Construct a tuple of degree 8.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9> Tuple9<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9)
      Construct a tuple of degree 9.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10> Tuple10<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10)
      Construct a tuple of degree 10.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11> Tuple11<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11)
      Construct a tuple of degree 11.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12> Tuple12<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12)
      Construct a tuple of degree 12.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12,​ T13> Tuple13<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13)
      Construct a tuple of degree 13.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12,​ T13,​ T14> Tuple14<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14)
      Construct a tuple of degree 14.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12,​ T13,​ T14,​ T15> Tuple15<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15)
      Construct a tuple of degree 15.
    • tuple

      public static <T1,​ T2,​ T3,​ T4,​ T5,​ T6,​ T7,​ T8,​ T9,​ T10,​ T11,​ T12,​ T13,​ T14,​ T15,​ T16> Tuple16<T1,​T2,​T3,​T4,​T5,​T6,​T7,​T8,​T9,​T10,​T11,​T12,​T13,​T14,​T15,​T16> tuple​(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, T13 v13, T14 v14, T15 v15, T16 v16)
      Construct a tuple of degree 16.
    • clone

      public Tuple<E> clone()
      Overrides:
      clone in class Object