import java.util.LinkedHashMap;import java.util.Map; public LRUCacheextends LinkedHashMap { private int cacheSize; public LRUCache(int cacheSize) { super(16, 0.75, true); this.cacheSize = cacheSize; } protected boolean removeEldestEntry(Map.Entry eldest) { return size() >= cacheSize; }}