Interface | Description |
---|---|
PairInterface<FIRST,SECOND> |
Pair interface.
|
Class | Description |
---|---|
CPair<FIRST extends Comparable<? super FIRST>,SECOND extends Comparable<? super SECOND>> |
Pair with canonical comparison function derived from the components comparable interfaces.
|
CTriple<FIRST extends Comparable<FIRST>,SECOND extends Comparable<SECOND>,THIRD extends Comparable<THIRD>> |
Triple with canonical comparison function.
|
DoubleDoublePair |
Pair storing two doubles.
|
DoubleIntPair |
Pair storing an integer and a double.
|
DoubleObjPair<O> |
Pair storing a native double value and an arbitrary object.
|
FCPair<FIRST extends Comparable<? super FIRST>,SECOND> |
Pair that can only be compared by it's first component.
|
IntDoublePair |
Pair storing an integer and a double.
|
IntIntPair |
Pair storing two integers.
|
Pair<FIRST,SECOND> |
Generic SimplePair
|
PairUtil |
Utility functions for (boxed) Pair classes.
|
PairUtil.Compare<FIRST,SECOND> |
Compare two SimplePairs based on two comparators
|
PairUtil.CompareByFirst<FIRST,SECOND> |
Compare two SimplePairs based on a comparator for the first component.
|
PairUtil.CompareBySecond<FIRST,SECOND> |
Compare two SimplePairs based on a comparator for the second component.
|
PairUtil.CompareNatural<FIRST extends Comparable<? super FIRST>,SECOND extends Comparable<? super SECOND>> |
Class to do a "natural order" comparison on this class.
|
PairUtil.CompareNaturalFirst<FIRST extends Comparable<? super FIRST>,SECOND> |
Class to do a natural comparison on this class' first component.
|
PairUtil.CompareNaturalSecond<FIRST,SECOND extends Comparable<? super SECOND>> |
Class to do a natural comparison on this class' second component.
|
PairUtil.CompareNaturalSwapped<FIRST extends Comparable<? super FIRST>,SECOND extends Comparable<? super SECOND>> |
Class to do a canonical swapped comparison on this class.
|
PairUtil.CompareSwapped<FIRST,SECOND> |
Compare two SimplePairs based on two comparators, but by second component
first.
|
SCPair<FIRST,SECOND extends Comparable<? super SECOND>> |
Pair that can only be compared by it's second component.
|
Triple<FIRST,SECOND,THIRD> |
Triple without comparison.
|
Pairs and triples utility classes.
Pairs and triples are frequently used classes and reimplemented too often.
Pair
is the generic non-comparable pair (you can use external comparators!).FCPair
is the generic pair comparable in the first component only.CPair
is the pair comparable in both components.SCPair
is the generic pair comparable in the second component only.Due to limitations in object subclassing, CPair
cannot be
a subclass of FCPair
, since a class cannot implement
the Comparable interface twice.
Also primitive types cannot be used in Generics, resulting in the following classes for primitive types:
IntIntPair
storing two int
valuesDoubleIntPair
storing one double
and one int
value.IntDoublePair
storing one int
and one double
value.DoubleDoublePair
storing two double
valuesTriples can be used via:
If you need a triple comparable in just particular components, either define a comparator for sorting or subclass Triple appropriately.