posted 24 years ago
You need a comparitor or a compareTo() method. If you have a compareTo(), you should have an equals(). If you have an equals(), you must have a hashCode(). So providing a comparitor might be simpler. However, here is a demo with CompareTo.