V (@NotNull K key, @NotNull V value) { KeyReference<K, V> keyReference = createKeyReference(key, value); ValueReference<K, V> valueReference = keyReference.getValueReference(); ValueReference<K, V> result = myMap.replace(keyReference, valueReference); V prev = result == null ? null : result.get(); processQueues(); return prev; }