Interface Tuple<CONCRETE_TUPLE extends Tuple<CONCRETE_TUPLE>>
-
- Type Parameters:
CONCRETE_TUPLE- the concreteTuplesub-type
- All Superinterfaces:
Serializable
public interface Tuple<CONCRETE_TUPLE extends Tuple<CONCRETE_TUPLE>> extends Serializable
Base interface for allTuple's.
ATupleis an immutable object that can contain the following (supported) number of elements:Number of element in Tuple Concrete TupletypeFactory method 0 Emptyempty()1 Singleof(Object)2 Pairof(Object, Object)3 Tripleof(Object, Object, Object)
Note:Tuple(and its subclasses) supportsObject.equals(Object)comparison using subclasses for the different subclasses
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description intarity()Number of arguments/elements in the Tuplestatic Emptyempty()static <T1,T2>
Pair<T1,T2>fromEntry(Map.Entry<? extends T1,? extends T2> entry)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 Detail
-
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
-
of
static <T1> Single<T1> of(T1 t1)
Create a newTuplewith 1 element- Type Parameters:
T1- the first element type- Parameters:
t1- the first element- Returns:
- the newly created
Singletuple
-
of
static <T1,T2> Pair<T1,T2> of(T1 t1, T2 t2)
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
static <T1,T2> Pair<T1,T2> fromEntry(Map.Entry<? extends T1,? extends T2> entry)
- Type Parameters:
T1- the first element typeT2- the second element type- Parameters:
entry- the map entry- Returns:
- the newly created
Pairtuple
-
of
static <T1,T2,T3> Triple<T1,T2,T3> of(T1 t1, T2 t2, T3 t3)
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
-
-