public class PriorityComparator<T> extends Object implements Comparator<T>
Modifier and Type | Field and Description |
---|---|
private Comparator<? super T> |
parent |
private Collection<T> |
priority |
Constructor and Description |
---|
PriorityComparator(Collection<T> priority,
Comparator<? super T> parent)
Create a new comparator.
|
PriorityComparator(SortedSet<T> priority)
Create a new comparator using the same sort order as the given
sorted set.
|
private final Collection<T> priority
private final Comparator<? super T> parent
public PriorityComparator(Collection<T> priority, Comparator<? super T> parent)
priority
- A collection containing the objects that should be
sorted firstparent
- The parent comparator used to sort the objectspublic int compare(T o1, T o2)
compare
in interface Comparator<T>