1099 if (first instanceof TreeNode)
1100 old = (t = (TreeNode<K,V>)first).getTreeNode(hash, key);
1101 else {
1102 Node<K,V> e = first; K k;
1103 do {
1104 if (e.hash == hash &&
1105 ((k = e.key) == key || (key != null && key.equals(k)))) {
1106 old = e;
1107 break;
1108 }
1109 ++binCount;
1110 } while ((e = e.next) != null);
1111 }
1112 V oldValue;
1113 if (old != null && (oldValue = old.value) != null) {
1114 afterNodeAccess(old);
1115 return oldValue;
1116 }
1117 }
1118 V v = mappingFunction.apply(key);
1119 if (old != null) {
1120 old.value = v;
1121 afterNodeAccess(old);
1122 return v;
1123 }
1124 else if (v == null)
1125 return null;
1126 else if (t != null)
1127 t.putTreeVal(this, tab, hash, key, v);
1128 else {
1129 tab[i] = newNode(hash, key, v, first);
1130 if (binCount >= TREEIFY_THRESHOLD - 1)
1131 treeifyBin(tab, hash);
1132 }
1133 ++modCount;
1134 ++size;
1135 afterNodeInsertion(true);
1136 return v;
1137 }
1138
1139 public V computeIfPresent(K key,
1140 BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
1141 if (remappingFunction == null)
1142 throw new NullPointerException();
1143 Node<K,V> e; V oldValue;
1144 int hash = hash(key);
1145 if ((e = getNode(hash, key)) != null &&
|
1099 if (first instanceof TreeNode)
1100 old = (t = (TreeNode<K,V>)first).getTreeNode(hash, key);
1101 else {
1102 Node<K,V> e = first; K k;
1103 do {
1104 if (e.hash == hash &&
1105 ((k = e.key) == key || (key != null && key.equals(k)))) {
1106 old = e;
1107 break;
1108 }
1109 ++binCount;
1110 } while ((e = e.next) != null);
1111 }
1112 V oldValue;
1113 if (old != null && (oldValue = old.value) != null) {
1114 afterNodeAccess(old);
1115 return oldValue;
1116 }
1117 }
1118 V v = mappingFunction.apply(key);
1119 if (v == null) {
1120 return null;
1121 } else if (old != null) {
1122 old.value = v;
1123 afterNodeAccess(old);
1124 return v;
1125 }
1126 else if (t != null)
1127 t.putTreeVal(this, tab, hash, key, v);
1128 else {
1129 tab[i] = newNode(hash, key, v, first);
1130 if (binCount >= TREEIFY_THRESHOLD - 1)
1131 treeifyBin(tab, hash);
1132 }
1133 ++modCount;
1134 ++size;
1135 afterNodeInsertion(true);
1136 return v;
1137 }
1138
1139 public V computeIfPresent(K key,
1140 BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
1141 if (remappingFunction == null)
1142 throw new NullPointerException();
1143 Node<K,V> e; V oldValue;
1144 int hash = hash(key);
1145 if ((e = getNode(hash, key)) != null &&
|