Fixed exceptions when removing values that don't exist from bi-maps
This commit is contained in:
parent
86a0909489
commit
3cbb56cfca
@ -300,7 +300,9 @@ class LockFreeIntBiMap<V> {
|
||||
public synchronized
|
||||
V remove(final int key) {
|
||||
V value = forwardHashMap.remove(key);
|
||||
reverseHashMap.remove(value, defaultReturnValue);
|
||||
if (value != null) {
|
||||
reverseHashMap.remove(value, defaultReturnValue);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,9 @@ class LockFreeObjectIntBiMap<V> {
|
||||
public synchronized
|
||||
int remove(final V key) {
|
||||
int value = forwardHashMap.remove(key, defaultReturnValue);
|
||||
reverseHashMap.remove(value);
|
||||
if (value != defaultReturnValue) {
|
||||
reverseHashMap.remove(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user