Package org.goplanit.utils.misc
Class ComparablePair<A extends Comparable,B extends Comparable>
- java.lang.Object
-
- org.goplanit.utils.misc.Pair<A,B>
-
- org.goplanit.utils.misc.ComparablePair<A,B>
-
- Type Parameters:
A
- first object in pairB
- second object in pair
- All Implemented Interfaces:
Comparable<Pair<A,B>>
public class ComparablePair<A extends Comparable,B extends Comparable> extends Pair<A,B> implements Comparable<Pair<A,B>>
Custom pair class similar to C++. By default we compare based on the first value- Author:
- markr
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ComparablePair(A first, B second)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Pair<A,B> o)
static <A extends Comparable,B extends Comparable>
ComparablePair<A,B>of(A valueA, B valueB)
Factory method-
Methods inherited from class org.goplanit.utils.misc.Pair
anyIsNotNull, anyIsNull, both, bothNotNull, bothNull, copy, different, empty, equals, first, firstNotNull, getEarliestNonNull, hashCode, isExactlyOneNonNull, of, second, secondNotNull, toString
-
-
-
-
Method Detail
-
of
public static <A extends Comparable,B extends Comparable> ComparablePair<A,B> of(A valueA, B valueB)
Factory method- Type Parameters:
A
- type of valueAB
- type of valueB- Parameters:
valueA
- firstvalueB
- second- Returns:
- new pair
-
compareTo
public int compareTo(Pair<A,B> o)
- Specified by:
compareTo
in interfaceComparable<A extends Comparable>
-
-