简体   繁体   中英

By what factor does Java increase the size of Set / Map, if the size has reached the load factor

By what factor does Java increase the size of Set / Map, if the size has reached the load factor ? Do we get double size of original Set / Map ?

From the source code, which comes with the JDK:

void addEntry(int hash, K key, V value, int bucketIndex) {
    Entry<K,V> e = table[bucketIndex];
    table[bucketIndex] = new Entry<>(hash, key, value, e);
    if (size++ >= threshold)
        resize(2 * table.length);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM