Skip to content

Commit 7390ef6

Browse files
authored
添加jdk1.8解决HashMap扩容死循环问题
添加jdk1.8解决HashMap扩容死循环问题
1 parent fa64796 commit 7390ef6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Java相关/这几道Java集合框架面试题几乎必问.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ static int hash(int h) {
190190

191191
这个过程为,先将 A 复制到新的 hash 表中,然后接着复制 B 到链头(A 的前边:B.next=A),本来 B.next=null,到此也就结束了(跟线程二一样的过程),但是,由于线程二扩容的原因,将 B.next=A,所以,这里继续复制A,让 A.next=B,由此,环形链表出现:B.next=A; A.next=B
192192

193+
**注意:jdk1.8已经解决了死循环的问题。**
193194

194195

195196
## HashSet 和 HashMap 区别

0 commit comments

Comments
 (0)