org.javatuples
Class Tuple

Object
  extended by 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
Author:
Daniel Fernández
See Also:
Serialized Form

Constructor Summary
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.
protected Tuple(Object... values)
           
 
Method Summary
 int compareTo(Tuple o)
           
 boolean contains(Object value)
           
 boolean containsAll(Collection<?> collection)
           
 boolean containsAll(Object... values)
           
 boolean equals(Object obj)
           
abstract  int getSize()
           Return the size of the tuple.
 Object getValue(int pos)
           Get the value at a specific position in the tuple.
 int hashCode()
           
 int indexOf(Object value)
           
 Iterator<Object> iterator()
           
 int lastIndexOf(Object value)
           
 Object[] toArray()
           
 List<Object> toList()
           
 String toString()
           
 
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 Detail

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>


Copyright © 2012 The JAVATUPLES team. All Rights Reserved.