--- jsr166/src/main/java/util/HashMap.java 2018/05/22 16:16:57 1.5 +++ jsr166/src/main/java/util/HashMap.java 2018/07/05 15:18:56 1.6 @@ -1263,9 +1263,7 @@ public class HashMap extends Abstra @Override public V merge(K key, V value, BiFunction remappingFunction) { - if (value == null) - throw new NullPointerException(); - if (remappingFunction == null) + if (value == null || remappingFunction == null) throw new NullPointerException(); int hash = hash(key); Node[] tab; Node first; int n, i; @@ -1308,8 +1306,7 @@ public class HashMap extends Abstra 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 extends Abstra ++modCount; ++size; afterNodeInsertion(true); + return value; } - return value; } @Override