diff --git a/notes/Java 容器.md b/notes/Java 容器.md index b7068ad9..600f36e2 100644 --- a/notes/Java 容器.md +++ b/notes/Java 容器.md @@ -754,6 +754,8 @@ new capacity : 00100000 - 为 0,那么 hash%00010000 = hash%00100000,桶位置和原来一致; - 为 1,hash%00100000 = hash%00010000 + 16,桶位置是原位置 + 16。 +

+ #### 7. 计算数组容量 HashMap 构造函数允许用户传入的容量不是 2 的 n 次方,因为它可以自动地将传入的容量转换为 2 的 n 次方。 diff --git a/notes/pics/hashmap-resize.png b/notes/pics/hashmap-resize.png new file mode 100644 index 00000000..6288b753 Binary files /dev/null and b/notes/pics/hashmap-resize.png differ