import IncomparableException; /** * Objects that can compare pairs of objects (for equality and * ordering). Typically used to help with sorting. * * @author Chris Kern * @author Erin Nichols * @author Joe Simonson * @author Samuel A. Rebelsky * @version 1.1b5 of October 1999 */ public interface Comparator { /** * Determine if the first element is strictly smaller than the * second. Throws an exception if the two elements cannot * be compared. */ public boolean lessThan(Object first, Object second) throws IncomparableException; /** * Determine if the first element is strictly larger than the * second. Throws an exception if the two elements cannot * be compared. */ public boolean greaterThan(Object first, Object second) throws IncomparableException; /** * Determine if the first element is equal to the second. Throws * an exception if the two elements cannot be compared. */ public boolean equals(Object first, Object second) throws IncomparableException; } // interface Comparator