8205620: Miscellaneous changes imported from jsr166 CVS 2018-07
Reviewed-by: martin, psandoz
--- a/src/java.base/share/classes/java/util/HashMap.java Tue Jul 10 10:24:08 2018 -0700
+++ b/src/java.base/share/classes/java/util/HashMap.java Tue Jul 10 10:24:08 2018 -0700
@@ -1263,9 +1263,7 @@
@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 @@
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 @@
++modCount;
++size;
afterNodeInsertion(true);
+ return value;
}
- return value;
}
@Override