posted 12 years ago
The code provided seems will not compile. You tend to create an objects set, but you intend to do operation on object variable. The SomeObject is made to implement Comparator but the method implemented is compareTo().
Anyways, below sample code does descending sorting on a TreeSet based on a custom comparator.