Difference between HashMap and TreeMap

Showing Answers 1 - 7 of 7 Answers

keerti

  • 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.

  Was this answer useful?  Yes

karthikeyan

  • Nov 9th, 2005
 

good

  Was this answer useful?  Yes

Tafazzul hasan

  • 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

  Was this answer useful?  Yes

Give your answer:

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

 

Related Answered Questions

 

Related Open Questions