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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(T o1, T o2)
-
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 Detail
-
priority
private final Collection<T> priority
-
parent
private final Comparator<? super T> parent
-
-
Constructor Detail
-
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
-
-
Method Detail
-
compare
public int compare(T o1, T o2)
- Specified by:
compare
in interfaceComparator<T>
-
-