How does the no-parameter constructor of HashMap construct a container with an initial capacity of 16?

The

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!

Apr.02,2021

The

comment says that it will be initialized only when it is used for the first time

  /**
     * The table, initialized on first use, and resized as
     * necessary. When allocated, length is always a power of two.
     * (We also tolerate length zero in some operations to allow
     * bootstrapping mechanics that are currently not needed.)
     */
    transient Node<K,V>[] table;

initialization code is found in the final Node < KJournal V > [] resize () method,


     Node<K,V>[] newTab = (Node<K,V>[])new Node[newCap];
     tablenewTab
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b365b8-2c00e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b365b8-2c00e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?