net.datastructures
Class DefaultComparator<E>
java.lang.Object
net.datastructures.DefaultComparator<E>
- All Implemented Interfaces:
- Comparator<E>
public class DefaultComparator<E>
- extends Object
- implements Comparator<E>
Comparator based on the natural ordering
- Author:
- Michael Goodrich
Method Summary |
int |
compare(E a,
E b)
Compares two given elements |
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(E a,
E b)
throws ClassCastException
- Compares two given elements
- Specified by:
compare
in interface Comparator<E>
- 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