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

Facebook Login
Site Registration

Which is better, to have a HashMap with large number of records or k number of small HashMaps in Java?

+4 votes
132 views
Which is better, to have a HashMap with large number of records or k number of small HashMaps in Java?
posted Sep 21, 2013 by Arvind Singh

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

1 Answer

0 votes

It depends on the different scenarios on which hashmap is used:-
1. If the objects in the hashMap are same then there is no point in having different hashmap as the traverse time in a hashmap is invariant to the size of the Map.
2.If the objects are of different type like one of Car class , other of Truck class etc then also one can have single hashmap but different hashmap would score over it as it increasesreadability of the code.

answer Sep 22, 2013 by Vinay Shukla
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
...