Java TreeSet
The Collection Framework provides two general-purpose implementations of
the set interface;
(i)HashSet
(ii)TreeSet
They are available in the java.util
package.
TreeSet stores objects in a sorted manner. It stores its elements in a tree
and they are automatically arranged in a sorted order.
It lets you access the elements in your collection by key, or sequentially by
key.
The TreeSet implementations are useful when the developers need to extract elements
from a collection in a sorted manner.
TreeSet is not synchronized i.e. if
more than one thread wants to access it at the same time then it must be
synchronized externally.
Read more at:
http:/www.roseindia.net/java/jdk6/TreeSetExample.shtml