The Load factor is a measure that decides when to increase the HashMap capacity to maintain the get() and put() operation complexity of O(1). The default load factor of HashMap is 0.75f (75% of the map size).
The initial capacity of the HashMap is the number of buckets in the hash table. It creates when we create the object of HashMap class. The initial capacity of the HashMap is 24, i.e.,16. The capacity of the HashMap is doubled each time it reaches the threshold. The capacity is increased to 25=32, 26=64, and so on.
One way to calculate size:
When the load factor ratio (m/n) reaches 0.75 at that time, hashmap increases its capacity.
Where,
m is the number of entries in a hashmap.(size of HashMap)
n is the total size of hashmap.