Junior
What is the default size of a HashMap when created?
sobes.tech AI
Answer from AI
Starting from Java 7, the default size of a HashMap when created without specifying an initial capacity is 16.
In Java 6 and earlier versions, this was also 16, but this size was more explicitly documented from Java 7 onwards.
Additionally, there is a default load factor of 0.75. When the number of elements in the HashMap exceeds the product of the current capacity and the load factor (16 * 0.75 = 12), the capacity automatically increases (doubles).