I was reading an IBM DeveloperWorks article to understand how ConcurrentHashMap is implemented. The section "removal operation" suggests that the removal operation is a two step process:
I have a question here though, because I examined the the corresponding code at Docjar and I don't see any cloning in remove(Object key, int hash, Object value)
.
I am not sure if I am missing something, or the implementation is different from the article?
The line
head = new Entry(p.hash, p.key, p.value, head);
does the cloning, it is not an "Object.clone()" cloning, but a "copy constructor" - this is still cloning in a more general sense.
Note that this line is in the 10-years old article, and cannot be found in the current implementation, where the implementation of remove(Object key, Object value)
is completely different.