Package 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 (on, 16 feb 2011) $
-
Field Summary
Fields Modifier and Type Field Description private Comparator<? super T>
parent
private Collection<T>
priority
-
Constructor Summary
Constructors Constructor 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. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
priority
-
parent
-
-
Constructor Details
-
PriorityComparator
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
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
-
-
Method Details
-
compare
- Specified by:
compare
in interfaceComparator<T>
-