@Test public void containsKey() throws Exception { int maxCapacity = 3; LRUCache cache = new LRUCache(maxCapacity); cache.put("1", 10); cache.put("2", 20); cache.put("3", 30); Assert.assertTrue(cache.containsKey("2")); Assert.assertFalse(cache.containsKey("4")); }
@Override public boolean containsKey(Object key) { try { lock.lock(); return super.containsKey(key); } finally { lock.unlock(); } }
LRUCache extends LinkedHashMap<K, V> { @Override public boolean containsKey(Object key) { try { lock.lock(); return super.containsKey(key); } finally { lock.unlock(); } } }
LRUCache extends LinkedHashMap<K, V> { @Override public boolean containsKey(Object key) { try { lock.lock(); return super.containsKey(key); } finally { lock.unlock(); } } LRUCache();  LRUCache(int maxCapacity); }
LRUCache extends LinkedHashMap<K, V> { @Override public boolean containsKey(Object key) { try { lock.lock(); return super.containsKey(key); } finally { lock.unlock(); } } LRUCache();  LRUCache(int maxCapacity); @Override boolean containsKey(Object key); @Override V get(Object key); @Override V put(K key, V value); @Override V remove(Object key); @Override int size(); @Override void clear(); int getMaxCapacity(); void setMaxCapacity(int maxCapacity); }
LRUCache extends LinkedHashMap<K, V> { @Override public boolean containsKey(Object key) { try { lock.lock(); return super.containsKey(key); } finally { lock.unlock(); } } LRUCache();  LRUCache(int maxCapacity); @Override boolean containsKey(Object key); @Override V get(Object key); @Override V put(K key, V value); @Override V remove(Object key); @Override int size(); @Override void clear(); int getMaxCapacity(); void setMaxCapacity(int maxCapacity);  }