1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-25 02:27:10 +08:00

Merge pull request #2105 from JacketFu/main

update hashmap-source-code.md
This commit is contained in:
Guide 2023-08-01 18:10:52 +08:00 committed by GitHub
commit 9ac4e6c1af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -453,7 +453,8 @@ final Node<K,V>[] resize() {
// 只有一个节点,直接计算元素新的位置即可
newTab[e.hash & (newCap - 1)] = e;
else if (e instanceof TreeNode)
// 将红黑树拆分成2棵子树拆分后的子树节点数小于等于6则将树转化成链表
// 将红黑树拆分成2棵子树如果子树节点数小于等于 UNTREEIFY_THRESHOLD默认为 6则将子树转换为链表。
// 如果子树节点数大于 UNTREEIFY_THRESHOLD则保持子树的树结构。
((TreeNode<K,V>)e).split(this, newTab, j, oldCap);
else {
Node<K,V> loHead = null, loTail = null;