Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Objects One way to order objects of a class can be ordered relative to one another . One way to do this is for the class to implement the Comparable interface. Library classes such as TreeSet and TreeMap accept Comparable objects and use their compareTo() methods to sort them. However, a class that implements the compareTo() method in an unexpected way can cause undesirable results.

...