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的疑问 #28

Closed
primejava opened this issue Apr 1, 2020 · 1 comment
Closed

对于ConcurrentHashMap & Hashtable的疑问 #28

primejava opened this issue Apr 1, 2020 · 1 comment

Comments

@primejava
Copy link

文中这句"如果没有,则将对象排斥锁赋值为this,即调用synchronizedMap的对象,就是上面的Map。"应该是错的,既然this.m是map对象,this怎么又会是map对象呢?我没太搞懂this指的是什么

@primejava
Copy link
Author

对于Hashtable为什么不允许key为null的解释也比较牵强.
文中说"如果你使用null值,就会使得其无法判断对应的key是不存在还是为空,因为你无法再调用一次contain(key)来对key是否存在进行判断,ConcurrentHashMap同理。"
但是我们都知道hashmap的containskey方法是可以判断一个key是不存在还是为空的,
个人认为不允许key为Null没什么理由,没什么道理可讲

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

No branches or pull requests

1 participant