ConcurrentHashMap的put方法
源码及注释如下:
public V put(K key, V value) {
return putVal(key, value, false);
}
final V putVal(K key, V value, boolean onlyIfAbsent) {
if (key == null || value == null) throw new NullPointerException();
// hash 对hashcode再散列
int hash = spread(key.hashCode());
int binCount = 0;
// 遍历bucket数组,自旋
for (Node<K,V>[] tab = table;;) {
Node<K,V> f; int n, i, fh;
// 懒加载 延迟构建
if