public class Tuple
extends java.lang.Object
implements java.lang.Iterable, java.io.Serializable
Collection of objects, each of which can be of an arbitrary type.| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object[] |
entries |
protected int |
size |
| Constructor and Description |
|---|
Tuple(java.util.Collection<java.lang.Object> values)
Creates a new
Tuple that holds the given values. |
Tuple(java.lang.Object... values)
Creates a new
Tuple that holds the given values. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.lang.Object |
get(int index)
Get the object at the given index.
|
int |
hashCode() |
java.util.Iterator<?> |
iterator() |
static <T1> Tuple1<T1> |
of(T1 t1)
Create a
Tuple1 with the given object. |
static <T1,T2> Tuple2<T1,T2> |
of(T1 t1,
T2 t2)
Create a
Tuple2 with the given objects. |
int |
size()
Return the number of elements in this Tuple.
|
java.lang.Object[] |
toArray()
Turn this Tuple into a plain Object array.
|
public Tuple(java.util.Collection<java.lang.Object> values)
Tuple that holds the given values.values - The values to holdpublic Tuple(java.lang.Object... values)
Tuple that holds the given values.values - The values to holdpublic static <T1> Tuple1<T1> of(T1 t1)
Tuple1 with the given object.T1 - The type of the first value.t1 - The first value in the tuple.Tuple1.public static <T1,T2> Tuple2<T1,T2> of(T1 t1, T2 t2)
Tuple2 with the given objects.T1 - The type of the first value.T2 - The type of the second value.t1 - The first value in the tuple.t2 - The second value in the tuple.Tuple2.public java.lang.Object get(int index)
index - The index of the object to retrieve. Starts at 0.public java.lang.Object[] toArray()
public int size()
public java.util.Iterator<?> iterator()
iterator in interface java.lang.Iterablepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Object