8205620: Miscellaneous changes imported from jsr166 CVS 2018-07

Reviewed-by: martin, psandoz
This commit is contained in:
Doug Lea 2018-07-10 10:24:08 -07:00
parent 08fb8e4d1c
commit 85daddd4cf

View File

@ -1263,9 +1263,7 @@ public class HashMap<K,V> extends AbstractMap<K,V>
@Override @Override
public V merge(K key, V value, public V merge(K key, V value,
BiFunction<? super V, ? super V, ? extends V> remappingFunction) { BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
if (value == null) if (value == null || remappingFunction == null)
throw new NullPointerException();
if (remappingFunction == null)
throw new NullPointerException(); throw new NullPointerException();
int hash = hash(key); int hash = hash(key);
Node<K,V>[] tab; Node<K,V> first; int n, i; Node<K,V>[] tab; Node<K,V> first; int n, i;
@ -1308,8 +1306,7 @@ public class HashMap<K,V> extends AbstractMap<K,V>
else else
removeNode(hash, key, null, false, true); removeNode(hash, key, null, false, true);
return v; return v;
} } else {
if (value != null) {
if (t != null) if (t != null)
t.putTreeVal(this, tab, hash, key, value); t.putTreeVal(this, tab, hash, key, value);
else { else {
@ -1320,8 +1317,8 @@ public class HashMap<K,V> extends AbstractMap<K,V>
++modCount; ++modCount;
++size; ++size;
afterNodeInsertion(true); afterNodeInsertion(true);
return value;
} }
return value;
} }
@Override @Override