1 changed files with 0 additions and 32 deletions
@ -1,32 +0,0 @@ |
|||
package com.homework; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
public class Cache<K, V> { |
|||
private final Map<K, V> map; |
|||
|
|||
public Cache() { |
|||
map = new HashMap<>(); |
|||
} |
|||
|
|||
public void put(K key, V value) { |
|||
map.put(key, value); |
|||
} |
|||
|
|||
public V get(K key) { |
|||
return map.get(key); |
|||
} |
|||
|
|||
public void remove(K key) { |
|||
map.remove(key); |
|||
} |
|||
|
|||
public void clear() { |
|||
map.clear(); |
|||
} |
|||
|
|||
public boolean containsKey(K key) { |
|||
return map.containsKey(key); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue