Interface ComparableTuple<CONCRETE_TUPLE extends ComparableTuple<CONCRETE_TUPLE>>
-
- Type Parameters:
CONCRETE_TUPLE- the concreteComparableTuplesub-type
- All Superinterfaces:
Comparable<CONCRETE_TUPLE>,Serializable
- All Known Implementing Classes:
ComparableEmpty,ComparablePair,ComparableSingle,ComparableTriple
public interface ComparableTuple<CONCRETE_TUPLE extends ComparableTuple<CONCRETE_TUPLE>> extends Comparable<CONCRETE_TUPLE>, Serializable
Base interface for allComparableTuple's.
AComparableTupleis an immutable object that can contain the following (supported) number of elements:Number of element in Tuple Concrete ComparableTupletypeFactory method 0 ComparableEmptyempty()1 ComparableSingleof(Comparable)2 ComparablePairof(Comparable, Comparable)3 ComparableTripleof(Comparable, Comparable, Comparable)
Note:ComparableTuple(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 ComparableEmptyempty()Create/Get andComparableEmptyComparableTuplestatic <T1 extends Comparable<? super T1>,T2 extends Comparable<? super T2>>
ComparablePair<T1,T2>fromEntry(Map.Entry<? extends T1,? extends T2> entry)static ComparableEmptyof()Create/Get andComparableEmptyTuplestatic <T1 extends Comparable<? super T1>>
ComparableSingle<T1>of(T1 t1)Create a newComparableTuplewith 1 elementstatic <T1 extends Comparable<? super T1>,T2 extends Comparable<? super T2>>
ComparablePair<T1,T2>of(T1 t1, T2 t2)Create a newComparableTuplewith 2 elementsstatic <T1 extends Comparable<? super T1>,T2 extends Comparable<? super T2>,T3 extends Comparable<? super T3>>
ComparableTriple<T1,T2,T3>of(T1 t1, T2 t2, T3 t3)Create a newComparableTuplewith 3 elementsList<?>toList()Convert the Tuple to a list-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
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
-
empty
static ComparableEmpty empty()
Create/Get andComparableEmptyComparableTuple- Returns:
- an
ComparableEmptyTuple
-
of
static ComparableEmpty of()
Create/Get andComparableEmptyTuple- Returns:
- an
ComparableEmptyTuple
-
of
static <T1 extends Comparable<? super T1>> ComparableSingle<T1> of(T1 t1)
Create a newComparableTuplewith 1 element- Type Parameters:
T1- the first element type- Parameters:
t1- the first element- Returns:
- the newly created
ComparableSingletuple
-
of
static <T1 extends Comparable<? super T1>,T2 extends Comparable<? super T2>> ComparablePair<T1,T2> of(T1 t1, T2 t2)
Create a newComparableTuplewith 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
ComparablePairtuple
-
fromEntry
static <T1 extends Comparable<? super T1>,T2 extends Comparable<? super T2>> ComparablePair<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
ComparablePairtuple
-
of
static <T1 extends Comparable<? super T1>,T2 extends Comparable<? super T2>,T3 extends Comparable<? super T3>> ComparableTriple<T1,T2,T3> of(T1 t1, T2 t2, T3 t3)
Create a newComparableTuplewith 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
ComparableTripletuple
-
-