We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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的next指针为final,但是参考如下openjdk的源码第204行可知
static final class HashEntry<K,V> { final int hash; final K key; volatile V value; volatile HashEntry<K,V> next;
next不是final修饰的。 另外你在文档中说concurrentHashMap的删除是复制节点被删节点前面的所有节点,但是参考源码第551行可知
final V remove(Object key, int hash, Object value) { if (!tryLock()) scanAndLock(key, hash); V oldValue = null; try { HashEntry<K,V>[] tab = table; int index = (tab.length - 1) & hash; HashEntry<K,V> e = entryAt(tab, index); HashEntry<K,V> pred = null; while (e != null) { K k; HashEntry<K,V> next = e.next; if ((k = e.key) == key || (e.hash == hash && key.equals(k))) { V v = e.value; if (value == null || value == v || value.equals(v)) { if (pred == null) setEntryAt(tab, index, next); else pred.setNext(next); ++modCount; --count; oldValue = v; } break; } pred = e; e = next; } } finally { unlock(); } return oldValue; }
链表的删除只是改变前后节点的指针,并不涉及复制操作。
个人面经写的很棒,非常感谢。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
在如图所示的第七页你说concurrentHashMap的next指针为final,但是参考如下openjdk的源码第204行可知
next不是final修饰的。
另外你在文档中说concurrentHashMap的删除是复制节点被删节点前面的所有节点,但是参考源码第551行可知
链表的删除只是改变前后节点的指针,并不涉及复制操作。
个人面经写的很棒,非常感谢。
The text was updated successfully, but these errors were encountered: