Possible Duplicate:
Why is the default capacity of ArrayList is 10?
Why are the default initial capacities of ArrayList and HashMap unequal?
- Default Initial Capacity of
ArrayList: 10 - Default Initial Capacity of
HashMap: 16
Also HashMap capacity is a power of two but not for ArrayList. This is as per JDK6.
HashMap uses an array which MUST have a size which is a power of 2 (as per the documentation). So I guess they chose the initial capacity that was the lowest value that is at least equal to the initial capacity of an ArrayList.
And these two numbers were also probably chosen based on statistics on actual programs, in order to have the best tradeoff between performance and memory consumption.
You can only guess, unless Josh Bloch comes in and explains us why these numbers were chosen when the collections framework was designed.