Just looking for the confirmation from experts here. I went through many threads regarding hashmap max capacity. Some people says it depends on memory as hashmap can grow
dynamically. I have one double, if I am not wrong hashmap internally uses array to hold it's elements and array size is in int, and maximum size of int in java is 2^31-1. So the max capacity of hash map is also 2^31-1 isn't it ??!!
Please clear the double ?
ॐ सर्वे जना: सुखिनो भवन्तु , तथास्तु |
'May the whole world be happy, so be it'
That's the maximum number of buckets. Each bucket uses a form of linked list which has no limitation except memory. So in theory a HashMap can hold an unlimited number of elements. In practice you won't even get to 2^30 because you will have run out of memory long before that.