“`” 主要原因在于 并发下的Rehash 会造成元素之间会形成一个循环链表。不过,jdk 1.8 后解决了这个问题,但是还是不建议在多线程下使用 HashMap,因为多线程下使用 HashMap 还是会存在其他问题比如数据丢失。并发环境下推荐使用 ConcurrentHashMap 。

详情请查看:<a href=""https://coolshell.cn/articles/9606.html"">https://coolshell.cn/articles/9606.html</a>

<pre><code> "“`

Was this helpful?

0 / 0

发表回复 0

Your email address will not be published.