Java TreeSet

The Collection Framework provides two general-purpose implementations of the set interface

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

 

Advertisements

Share on Google+Share on Google+

Java TreeSet

Posted on: June 15, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Java TreeSet  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads