import java.util.Comparator;
import java.util.TreeSet;
public class TreeSetDemo {
public static void main(String[] args) {
TreeSet treeSet = new TreeSet(new Comparator() {
@Override
public int compare(Object o1, Object o2) {
String s1 = o1.toString();
String s2 = o2.toString();
return s2.compareTo(s1);
}
});
treeSet.add("The");
treeSet.add("Code");
treeSet.add("Data");
treeSet.add("Java");
treeSet.add("Program");
System.out.println(treeSet);
}
}