mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +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) {
|
if (c == null) {
|
||||||
insert(helper.make(key, value, null));
|
insert(helper.make(key, value, null));
|
||||||
} else {
|
} else {
|
||||||
V old = c.getValue();
|
|
||||||
c.setValue(value);
|
c.setValue(value);
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
@ -180,8 +179,15 @@ public class HashMap<K, V> implements Map<K, V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public V put(K key, V value) {
|
public V put(K key, V value) {
|
||||||
Cell<K, V> c = putCell(key, value);
|
Cell<K, V> c = find(key);
|
||||||
return (c == null ? null : c.getValue());
|
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) {
|
public void putAll(Map<? extends K,? extends V> elts) {
|
||||||
|
Loading…
Reference in New Issue
Block a user