Skip to content

Commit 844801e

Browse files
committed
HashMap 更新
1 parent ad6183e commit 844801e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

MD/HashMap.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ get 和 put 类似,也是将传入的 Key 计算出 index ,如果该位置
3232

3333
> 所以 HashMap 只能在单线程中使用,并且尽量的预设容量,尽可能的减少扩容。
3434
35+
`JDK1.8` 中对 `HashMap` 进行了优化:
36+
当 hash 碰撞之后写入链表的长度超过了阈值(默认为8),链表将会转换为红黑树。
37+
3538
多线程场景下推荐使用 [ConcurrentHashMap](https://github.com/crossoverJie/Java-Interview/blob/master/MD/ConcurrentHashMap.md)

0 commit comments

Comments
 (0)