TreeSet t=new TreeSet();
t.add("Z");====>"Z".compareTo("A");(positive) how much positive number it comes?
t.add("A");====>"A".compareTo("B");(negative)//here while jvm doing default natural sorting i thought instead of B, Z has to be compared with A but B is being compared with A since B is root element. What is meaning of root element. why Z is not root element??
System.out.println(t)//comes [A,B,Z} right not [Z,B,A]
how to get custom sorting like Z B A
why StringBuffer does not support default natural sorting. How to sort String Buffer objects.
obj1.compareTo(obj2)//obj2 is already present element in tree set and obj1 is new element being added??