You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
598 B
32 lines
598 B
package fx;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
public class Cache<K, V> {
|
|
private final Map<K, V> storage = new HashMap<>();
|
|
|
|
public void put(K key, V value) {
|
|
storage.put(key, value);
|
|
}
|
|
|
|
public V get(K key) {
|
|
return storage.get(key);
|
|
}
|
|
|
|
public boolean containsKey(K key) {
|
|
return storage.containsKey(key);
|
|
}
|
|
|
|
public void remove(K key) {
|
|
storage.remove(key);
|
|
}
|
|
|
|
public void clear() {
|
|
storage.clear();
|
|
}
|
|
|
|
public int size() {
|
|
return storage.size();
|
|
}
|
|
}
|
|
|