top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Java: How to decide between HashMap and TreeMap?

0 votes
141 views

What is the key difference between a HashMap and a TreeMap and what should be the key factor to choose HashMap or a TreeMap?

posted Mar 14, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

Because HahsMap gives better performance if you don’t need sorting then go for HashMap otherwise TreeMap would be choice. You have also option available to use LinkdeHashMap which is same fast as HashMap including it gives remove/add/contains functionality and also maintains insertion order.

answer Mar 16, 2016 by Shubham Singh
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...