Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentHashMap和Hashtable到底有什么不同? | Leo Yang's Blog #17

Open
leo-yang0201 opened this issue Mar 10, 2020 · 0 comments

Comments

@leo-yang0201
Copy link
Owner

https://leo-yang0201.github.io/leo-yang0201.github.io/2020/03/10/ConcurrentHashMap%E5%92%8CHashtable%E7%9A%84%E5%8C%BA%E5%88%AB/

面试只要是问到多线程相关的知识,这个问题是很常见的,我查了几篇资料然后做了一下总结: 首先HashMap它不是线程安全的,在多线程情况下HashMap可能出现以下线程安全问题: 多线程的put可能导致元素的丢失试验代码: 注:仅作为可能会产生这个问题的样例代码,直接运行不一定会产生问题 123456789101112131415161718192021222324252627282930publi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant