-
- All Implemented Interfaces:
-
java.util.Comparator
public class CandidatePair.PairComparator implements Comparator<CandidatePair>
A Comparator using the compareTo method of the CandidatePair
-
-
Method Summary
Modifier and Type Method Description intcompare(CandidatePair pair1, CandidatePair pair2)Compares pair1 and pair2 for order. booleanequals(Object obj)Indicates whether some other object is "equal to" to this Comparator. -
Methods inherited from class java.util.Comparator
comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reverseOrder, reversed, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
compare
int compare(CandidatePair pair1, CandidatePair pair2)
Compares pair1 and pair2 for order. Returns a negative integer, zero, or a positive integer as pair1's priority is greater than, equal to, or less than the one of the pair2, thus insuring that higher priority pairs will come first.
- Parameters:
pair1- the first CandidatePair to be compared.pair2- the second CandidatePair to be compared.
-
equals
boolean equals(Object obj)
Indicates whether some other object is "equal to" to this Comparator. This method must obey the general contract of Object.equals(Object). Additionally, this method can return trueonly if the specified Object is also a comparator and it imposes the same ordering as this comparator. Thus,
comp1.equals(comp2)implies that sgn(comp1.compare(o1,o2))==sgn(comp2.compare(o1, o2)) for every object reference o1 and o2.Note that it is always safe not to override Object.equals(Object). However, overriding this method may, in some cases, improve performance by allowing programs to determine that two distinct Comparators impose the same order.
- Parameters:
obj- the reference object with which to compare.
-
-
-
-