HashMap no-parameter constructor is as follows:
/**
* Constructs an empty <tt>HashMap</tt> with the default initial capacity
* (16) and the default load factor (0.75).
*/
public HashMap() {
this.loadFactor = DEFAULT_LOAD_FACTOR; // all other fields defaulted
}
how does it construct a container with an initial capacity of 16, as it says in its Javadoc? Doesn"t the Node array have to be initialized? Add at least one sentence
table = new Node<>[DEFAULT_INITIAL_CAPACITY];
is only reasonable!
Please give us your advice!