gov.sandia.cognition.collection
Class DefaultComparator<T extends Comparable<? super T>>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by 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

Constructor Summary
DefaultComparator()
          Creates a new DefaultComparator.
 
Method Summary
 int compare(T o1, T o2)
           
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

DefaultComparator

public DefaultComparator()
Creates a new DefaultComparator.

Method Detail

compare

public int compare(T o1,
                   T o2)
Specified by:
compare in interface Comparator<T extends Comparable<? super T>>