Hi.
What is the difference between TreeSet and HashSet?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prabhu RajaPosted Nov 17, 2011, 2:04 AM
http://vidyapsi.wordpress.com/2009/01/22/treeset-vs-hashset-vs-linkedhashset/
AartiPosted Nov 17, 2011, 12:54 AM
A treeSet organizes data in a tree through use of Comparator (natural ordering) and the hashSet organizes data in a hash table (using a hash function).
See the Java API for more info:
http://www.j2ee.me/javase/6/docs/api/java/util/TreeSet.html
http://java.sun.com/javase/6/docs/api/java/util/HashSet.html
The previous answer (unless I'm mistaken) is pretty much completely wrong...
Regards
VulpesPosted Oct 31, 2011, 1:01 PM
http://download.oracle.com/javase/6/docs/api/java/util/HashSet.html
http://download.oracle.com/javase/6/docs/api/java/util/TreeSet.html