Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 72b12c4

Browse files
Merge pull request Snailclimb#39 from kinglaw1204/patch-4
添加jdk1.8解决HashMap扩容死循环问题
2 parents 1af60b0 + 7390ef6 commit 72b12c4

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
@@ -192,6 +192,7 @@ static int hash(int h) {
192192

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

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

196197

197198
## HashSet 和 HashMap 区别

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /