Fixed exceptions when removing values that don't exist from bi-maps

This commit is contained in:
Robinson 2021-05-01 00:28:29 +02:00
parent 86a0909489
commit 3cbb56cfca
2 changed files with 6 additions and 2 deletions

View File

@ -300,7 +300,9 @@ class LockFreeIntBiMap<V> {
public synchronized
V remove(final int key) {
V value = forwardHashMap.remove(key);
if (value != null) {
reverseHashMap.remove(value, defaultReturnValue);
}
return value;
}

View File

@ -276,7 +276,9 @@ class LockFreeObjectIntBiMap<V> {
public synchronized
int remove(final V key) {
int value = forwardHashMap.remove(key, defaultReturnValue);
if (value != defaultReturnValue) {
reverseHashMap.remove(value);
}
return value;
}