Add hashmap-vs-concurrenthashmap module: JDK 25 sizeCtl/treeify internals, forced and measured lost updates
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7rnC7jppGGdHGESvy
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
null keys and values: HashMap allows, ConcurrentHashMap rejects
|
||||
===============================================================
|
||||
|
||||
HashMap.put(null, ..) accepted; the null key lives in table[0]: true
|
||||
HashMap.get(null) = for-null-key
|
||||
HashMap.get("present-but-null") = null containsKey = true
|
||||
HashMap.get("absent") = null containsKey = false <- get() alone cannot tell these two apart
|
||||
ConcurrentHashMap put(null, v), put(k, null), get(null), containsKey(null), merge(k, null, f): all throw NullPointerException
|
||||
compute(k, (k,v) -> null) removes the entry instead: containsKey(k) = false
|
||||
Reference in New Issue
Block a user