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