/** * Objects that can compare pairs of objects (for equality and * ordering). We assume that if something is neither less than * or equal to another object, then it is greater than that other * object. Typically used to help with sorting. * * @author Samuel A. Rebelsky * @version 1.1 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 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