GeekInterview.com
Series: Subject: Topic:
Question: 1002 of 2109

Difference between HashMap and TreeMap

Asked by: Interview Candidate | Asked on: Sep 28th, 2005
Showing Answers 1 - 5 of 5 Answers
keerti

Answered On : Oct 21st, 2005

HashMap will not store the elements in order.Whereas TreeMap stores in order.so while retrieving we will get in a particular order.But for HashMap we won't.

  
Login to rate this answer.
karthikeyan

Answered On : Nov 9th, 2005

Good

  
Login to rate this answer.
gagan2914

Answered On : Nov 11th, 2005

View all answers by gagan2914

1> Treemap are sorted map while hashmap are not

  
Login to rate this answer.
justAnother

Answered On : Nov 15th, 2005

View all answers by justAnother

The following link provides a table with details of collections in java. http://mindprod.com/jgloss/collection.html

  
Login to rate this answer.
Tafazzul hasan

Answered On : Feb 21st, 2007

  Differences...  a> HashMap provides the implementation of Map Interface by using hashtable         where as TreeMap provides the implementation of Map Interface by using Tree.  b> HashMap does not guarntee any order         TreeMap provides sorted order

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.