net.sf.basedb.util
Class PriorityComparator<T>
java.lang.Object
net.sf.basedb.util.PriorityComparator<T>
- All Implemented Interfaces:
- Comparator<T>
public class PriorityComparator<T>
- extends Object
- implements Comparator<T>
A comparator implemenation that sorts a given set of
objects before all other object.
- Since:
- 2.17
- Author:
- Nicklas
- Last modified
- $Date: 2011-02-16 14:49:40 +0100 (Wed, 16 Feb 2011) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
priority
private final Collection<T> priority
parent
private final Comparator<? super T> parent
PriorityComparator
public PriorityComparator(Collection<T> priority,
Comparator<? super T> parent)
- Create a new comparator.
- Parameters:
priority
- A collection containing the objects that should be
sorted firstparent
- The parent comparator used to sort the objects
PriorityComparator
public PriorityComparator(SortedSet<T> priority)
- Create a new comparator using the same sort order as the given
sorted set.
- Parameters:
priority
- A collection containing the objects that should be
sorted first
compare
public int compare(T o1,
T o2)
- Specified by:
compare
in interface Comparator<T>