public class Tuple extends Object implements Iterable, Serializable
Collection
of objects, each of which can be of an arbitrary type.Modifier and Type | Field and Description |
---|---|
protected int |
size |
Modifier | Constructor and Description |
---|---|
protected |
Tuple(int size)
Creates a new
Tuple that holds the given values . |
Modifier and Type | Method and Description |
---|---|
static Tuple |
empty()
Create a
Tuple1 with the given object. |
boolean |
equals(Object o) |
Object |
get(int index)
Get the object at the given index.
|
int |
hashCode() |
Iterator<?> |
iterator() |
static TupleN |
of(List<?> list)
Create a
TupleN with the given object. |
static TupleN |
of(Object[] list)
Create a
TupleN with the given object. |
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. |
static <T1,T2,T3> Tuple3<T1,T2,T3> |
of(T1 t1,
T2 t2,
T3 t3)
Create a
Tuple3 with the given objects. |
static <T1,T2,T3,T4> |
of(T1 t1,
T2 t2,
T3 t3,
T4 t4)
Create a
Tuple4 with the given objects. |
static <T1,T2,T3,T4,T5> |
of(T1 t1,
T2 t2,
T3 t3,
T4 t4,
T5 t5)
Create a
Tuple5 with the given objects. |
static <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. |
static <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. |
static <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. |
int |
size()
Return the number of elements in this Tuple.
|
Object[] |
toArray()
Turn this Tuple into a plain Object array.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected Tuple(int size)
Tuple
that holds the given values
.size
- The number of values to holdpublic static TupleN of(Object[] list)
TupleN
with the given object.list
- Build an unbounded tupleTupleN
.public static TupleN of(List<?> list)
TupleN
with the given object.list
- Build an unbounded tupleTupleN
.public 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 static <T1,T2,T3> Tuple3<T1,T2,T3> of(T1 t1, T2 t2, T3 t3)
Tuple3
with the given objects.T1
- The type of the first value.T2
- The type of the second value.T3
- The type of the third value.t1
- The first value in the tuple.t2
- The second value in the tuple.t3
- The third value in the tuple.Tuple3
.public static <T1,T2,T3,T4> Tuple4<T1,T2,T3,T4> of(T1 t1, T2 t2, T3 t3, T4 t4)
Tuple4
with the given objects.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.t1
- The first value in the tuple.t2
- The second value in the tuple.t3
- The third value in the tuple.t4
- The fourth value in the tuple.Tuple4
.public static <T1,T2,T3,T4,T5> Tuple5<T1,T2,T3,T4,T5> of(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5)
Tuple5
with the given objects.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.t1
- The first value in the tuple.t2
- The second value in the tuple.t3
- The third value in the tuple.t4
- The fourth value in the tuple.t5
- The fifth value in the tuple.Tuple5
.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)
Tuple6
with the given objects.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.t1
- The first value in the tuple.t2
- The second value in the tuple.t3
- The third value in the tuple.t4
- The fourth value in the tuple.t5
- The fifth value in the tuple.t6
- The sixth value in the tuple.Tuple6
.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)
Tuple7
with the given objects.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.t1
- The first value in the tuple.t2
- The second value in the tuple.t3
- The third value in the tuple.t4
- The fourth value in the tuple.t5
- The fifth value in the tuple.t6
- The sixth value in the tuple.t7
- The seventh value in the tuple.Tuple7
.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)
Tuple8
with the given objects.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.t1
- The first value in the tuple.t2
- The second value in the tuple.t3
- The third value in the tuple.t4
- The fourth value in the tuple.t5
- The fifth value in the tuple.t6
- The sixth value in the tuple.t7
- The seventh value in the tuple.t8
- The eighth value in the tuple.Tuple8
.@Nullable public Object get(int index)
index
- The index of the object to retrieve. Starts at 0.public Object[] toArray()
public int size()
Copyright © 2016. All rights reserved.