### Question:
LRUCache extends LinkedHashMap<K, V> { @Override protected boolean removeEldestEntry(java.util.Map.Entry<K, V> eldest) { return size() > maxCapacity; } 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);  }### Answer:
@Test public void removeEldestEntry() throws Exception { int maxCapacity = 3; LRUCache cache = new LRUCache(maxCapacity); cache.put("1", 10); cache.put("2", 20); cache.put("3", 30); Assert.assertFalse(cache.removeEldestEntry(null)); cache.put("4", 40); Assert.assertFalse(cache.removeEldestEntry(null)); }