Reverse order a TreeSet
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
public class Main {
public static void main (String args[]) throws Exception {
String elements[] = {"a", "b","c", "d", "e"};
Set set = new TreeSet(Collections.reverseOrder());
for (int i=0, n=elements.length; i<n; i++) {
set.add(elements[i]);
}
System.out.println(set);
}
}