package rebelsky.hw20; /** * Things like strings that compare to arbitrary other objects by * first converting them to strings. * * @author Samuel A. Rebelsky * @version 1.0 of September 2004 */ public class GeneralString implements Comparable { String str; public GeneralString(String original) { this.str = original; } // GeneralString /** * Compare to other objects by converting them to strings. */ public int compareTo(Object other) { return this.str.compareTo(other.toString()); } // compareTo(String) /** * Convert to a string. */ public String toString() { return str; } // toString() } // GeneralString