1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

concurrencyHashMap源码分析错别字勘误

This commit is contained in:
Zzr-rr 2024-05-06 16:47:03 +08:00
parent 71be32559b
commit be55c433c0

View File

@ -328,7 +328,7 @@ private void rehash(HashEntry<K,V> node) {
HashEntry<K,V> e = oldTable[i]; HashEntry<K,V> e = oldTable[i];
if (e != null) { if (e != null) {
HashEntry<K,V> next = e.next; HashEntry<K,V> next = e.next;
// 计算新的位置,新的位置只可能是不便或者是老的位置+老的容量。 // 计算新的位置,新的位置只可能是不或者是老的位置+老的容量。
int idx = e.hash & sizeMask; int idx = e.hash & sizeMask;
if (next == null) // Single node on list if (next == null) // Single node on list
// 如果当前位置还不是链表,只是一个元素,直接赋值 // 如果当前位置还不是链表,只是一个元素,直接赋值
@ -337,7 +337,7 @@ private void rehash(HashEntry<K,V> node) {
// 如果是链表了 // 如果是链表了
HashEntry<K,V> lastRun = e; HashEntry<K,V> lastRun = e;
int lastIdx = idx; int lastIdx = idx;
// 新的位置只可能是不便或者是老的位置+老的容量。 // 新的位置只可能是不或者是老的位置+老的容量。
// 遍历结束后lastRun 后面的元素位置都是相同的 // 遍历结束后lastRun 后面的元素位置都是相同的
for (HashEntry<K,V> last = next; last != null; last = last.next) { for (HashEntry<K,V> last = next; last != null; last = last.next) {
int k = last.hash & sizeMask; int k = last.hash & sizeMask;