do not add/remove null values
This commit is contained in:
@@ -20,7 +20,11 @@ public class LRUCache<K, V> {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user