Interface HeapPriorityQueue.PriorityComparator<T>
- Type Parameters:
T- type of the compared objects.
- Enclosing class:
- HeapPriorityQueue<T extends HeapPriorityQueue.HeapPriorityQueueElement>
public static interface HeapPriorityQueue.PriorityComparator<T>
This interface works similar to
Comparable and is used to prioritize between two
objects. The main difference between this interface and Comparable is it is not
require to follow the usual contract between that Comparable.compareTo(Object) and
Object.equals(Object). The contract of this interface is: When two objects are equal,
they indicate the same priority, but indicating the same priority does not require that both
objects are equal.-
Method Summary
Modifier and TypeMethodDescriptionintcomparePriority(T left, T right) Compares two objects for priority.
-
Method Details
-
comparePriority
Compares two objects for priority. Returns a negative integer, zero, or a positive integer as the first argument has lower, equal to, or higher priority than the second.- Parameters:
left- left operand in the comparison by priority.right- left operand in the comparison by priority.- Returns:
- a negative integer, zero, or a positive integer as the first argument has lower, equal to, or higher priority than the second.
-