Tag Archive

Java’s Sorted Collections and the Comparable and Comparator Interfaces

Published on October 31, 2009 By chris

Java’s SortedSet interface and the classes that implement it (like TreeSet) will store a collection of objects that are sortable. In order to make a class sortable so that we can store it in a sorted collection, we have two choices: the sorted class can implement the Comparable interface we can pass a Comparator to [...]

  • Share/Bookmark