gov.sandia.cognition.collection
Class DefaultComparator<T extends Comparable<? super T>>
java.lang.Object
gov.sandia.cognition.util.AbstractCloneableSerializable
gov.sandia.cognition.collection.DefaultComparator<T>
- Type Parameters:
T
- The type being compared. Must be Comparable
.
- All Implemented Interfaces:
- CloneableSerializable, Serializable, Cloneable, Comparator<T>
@CodeReview(reviewer="Kevin R. Dixon",
date="2008-12-02",
changesNeeded=false,
comments="Looks good.")
public class DefaultComparator<T extends Comparable<? super T>>
- extends AbstractCloneableSerializable
- implements Comparator<T>
A default comparator that just calls compare on the comparable generic
it uses. Thus, it creates the natural ordering according to the compareTo
method on the Comparable
objects it is given.
- Since:
- 2.1
- Author:
- Justin Basilico
- See Also:
- Serialized Form
DefaultComparator
public DefaultComparator()
- Creates a new
DefaultComparator
.
compare
public int compare(T o1,
T o2)
- Specified by:
compare
in interface Comparator<T extends Comparable<? super T>>