the same book page 563
Optionally, you can
construct a TreeSet with a constructor that lets you give the collection your own
rules for what the order should be (rather than relying on the ordering defined by
the elements' class) by using a Comparable or Comparator. As of Java 6, TreeSet
implements NavigableSet.
Actually the natural order is determind by the programer who implemented the compareTo() method from the Comparable interface into the elements.
but if you wish a different ordering you can only use: Compartor as the TreeSet constructors shows
TreeSet API:"This also applied to the Map Interface"
TreeSet()
Constructs a new, empty tree set, sorted according to the natural ordering of its elements.
TreeSet(Collection<? extends E> c)
Constructs a new tree set containing the elements in the specified collection, sorted according to the natural ordering of its elements.
TreeSet(Comparator<? super E> comparator)
Constructs a new, empty tree set, sorted according to the specified comparator.
TreeSet(SortedSet<E> s)
Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.