net.datastructures
Class DefaultComparator
java.lang.Object
net.datastructures.DefaultComparator
- All Implemented Interfaces:
- Comparator, Serializable
- public class DefaultComparator
- extends Object
- implements Comparator, Serializable
A default comparator, which uses the natural ordering
- Author:
- Michael Goodrich
- See Also:
- Serialized Form
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultComparator
public DefaultComparator()
compare
public int compare(Object a,
Object b)
throws ClassCastException
- Compares a to b.
- Specified by:
compare
in interface Comparator
- Returns:
- a negative integer if a is less than b,
zero if a equals b, or a positive integer if
a is greater than b
- Throws:
ClassCastException