Interface Tuple<CONCRETE_TUPLE extends Tuple<CONCRETE_TUPLE>>
- Type Parameters:
CONCRETE_TUPLE- the concreteTuplesub-type
- All Superinterfaces:
Serializable
Base interface for all
A
Note:
Tuple's.A
Tuple is an immutable object that can contain the following (supported) number of elements:
| Number of element in Tuple | Concrete Tuple type | Factory method |
| 0 | Empty | empty() |
| 1 | Single | of(Object) |
| 2 | Pair | of(Object, Object) |
| 3 | Triple | of(Object, Object, Object) |
Note:
Tuple (and its subclasses) supports Object.equals(Object) comparison using subclasses for the different subclasses-
Method Summary
Modifier and TypeMethodDescriptionintarity()Number of arguments/elements in the Tuplestatic Emptyempty()static <T1,T2> Pair<T1, T2> static Emptyof()static <T1> Single<T1>of(T1 t1) Create a newTuplewith 1 elementstatic <T1,T2> Pair<T1, T2> of(T1 t1, T2 t2) Create a newTuplewith 2 elementsstatic <T1,T2, T3> Triple<T1, T2, T3> of(T1 t1, T2 t2, T3 t3) Create a newTuplewith 3 elementsList<?>toList()Convert the Tuple to a list
-
Method Details
-
arity
int arity()Number of arguments/elements in the Tuple- Returns:
- Number of arguments/elements in the Tuple
-
toList
List<?> toList()Convert the Tuple to a list- Returns:
- list of all Tuple elements
-
empty
-
of
-
of
Create a newTuplewith 1 element- Type Parameters:
T1- the first element type- Parameters:
t1- the first element- Returns:
- the newly created
Singletuple
-
of
Create a newTuplewith 2 elements- Type Parameters:
T1- the first element typeT2- the second element type- Parameters:
t1- the first elementt2- the second element- Returns:
- the newly created
Pairtuple
-
fromEntry
- Type Parameters:
T1- the first element typeT2- the second element type- Parameters:
entry- the map entry- Returns:
- the newly created
Pairtuple
-
of
Create a newTuplewith 3 elements- Type Parameters:
T1- the first element typeT2- the second element typeT3- the third element type- Parameters:
t1- the first elementt2- the second elementt3- the third element- Returns:
- the newly created
Tripletuple
-