Class Tuple

java.lang.Object
org.javatuples.Tuple
All Implemented Interfaces:
Serializable, Comparable<Tuple>, Iterable<Object>
Direct Known Subclasses:
Decade, Ennead, KeyValue, LabelValue, Octet, Pair, Quartet, Quintet, Septet, Sextet, Triplet, Unit

public abstract class Tuple extends Object implements Iterable<Object>, Serializable, Comparable<Tuple>

Abstract base class for all tuple classes.

Since:
1.0
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • valueArray

      private final Object[] valueArray
    • valueList

      private final List<Object> valueList
  • Constructor Details

    • Tuple

      @Deprecated protected Tuple(int size, Object... values)
      Deprecated.
      Will be removed in 1.4. The "size" parameter is of no use at this level, so use the simpler Tuple(values) constructor instead.
    • Tuple

      protected Tuple(Object... values)
  • Method Details

    • getSize

      public abstract int getSize()

      Return the size of the tuple.

      Returns:
      the size of the tuple.
    • getValue

      public final Object getValue(int pos)

      Get the value at a specific position in the tuple. This method has to return object, so using it you will lose the type-safety you get with the getValueX() methods.

      Parameters:
      pos - the position of the value to be retrieved.
      Returns:
      the value
    • iterator

      public final Iterator<Object> iterator()
      Specified by:
      iterator in interface Iterable<Object>
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • contains

      public final boolean contains(Object value)
    • containsAll

      public final boolean containsAll(Collection<?> collection)
    • containsAll

      public final boolean containsAll(Object... values)
    • indexOf

      public final int indexOf(Object value)
    • lastIndexOf

      public final int lastIndexOf(Object value)
    • toList

      public final List<Object> toList()
    • toArray

      public final Object[] toArray()
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(Tuple o)
      Specified by:
      compareTo in interface Comparable<Tuple>