mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
fix return value of HashMap.put()
This commit is contained in:
parent
96c3b2b6a7
commit
64313aa243
@ -136,7 +136,6 @@ public class HashMap<K, V> implements Map<K, V> {
|
||||
if (c == null) {
|
||||
insert(helper.make(key, value, null));
|
||||
} else {
|
||||
V old = c.getValue();
|
||||
c.setValue(value);
|
||||
}
|
||||
return c;
|
||||
@ -180,8 +179,15 @@ public class HashMap<K, V> implements Map<K, V> {
|
||||
}
|
||||
|
||||
public V put(K key, V value) {
|
||||
Cell<K, V> c = putCell(key, value);
|
||||
return (c == null ? null : c.getValue());
|
||||
Cell<K, V> c = find(key);
|
||||
if (c == null) {
|
||||
insert(helper.make(key, value, null));
|
||||
return null;
|
||||
} else {
|
||||
V old = c.getValue();
|
||||
c.setValue(value);
|
||||
return old;
|
||||
}
|
||||
}
|
||||
|
||||
public void putAll(Map<? extends K,? extends V> elts) {
|
||||
|
Loading…
Reference in New Issue
Block a user