compare() is used by TreeSet to determine order of its elements.
You overrides String.compare() in your class. However inside your overriden compare(String a, String b) method you return b.compare(a) instead of a.compare(b), so natural lexicographic order (which is returned from String.compare()) is reversed.
EDIT: not compareTo() but compare() ;)
posted 7 years ago
Thanks Tomasz Sochanski...
You can thank my dental hygienist for my untimely aliveness. So tiny: