do not add/remove null values

This commit is contained in:
2020-10-04 17:17:32 +02:00
parent ea7ba042df
commit fbd07e465b

View File

@@ -20,7 +20,11 @@ public class LRUCache<K, V> {
} }
public V put(final K key, final V value) { public V put(final K key, final V value) {
return cache.put(key, value); if (value == null) {
return remove(key);
} else {
return cache.put(key, value);
}
} }
public V get(final K key) { public V get(final K key) {