Advertisement
Guest User

Untitled

a guest
May 1st, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. public abstract class Cache<K, V> {
  2.  
  3. private Map<K, V> map = new HashMap<>();
  4.  
  5. public void add(K key, V val) {
  6. map.put(key, val);
  7. }
  8.  
  9. public void remove(K key) {
  10. map.remove(key);
  11. }
  12.  
  13. public boolean has(K key) {
  14. return map.containsKey(key);
  15. }
  16.  
  17. public V get(K key) {
  18. return map.get(key);
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement