mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-12 16:37:45 +00:00
22 lines
430 B
Java
22 lines
430 B
Java
package codechicken.nei;
|
|
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
|
|
// Simple LRUCache
|
|
public class LRUCache<K, V> extends LinkedHashMap<K, V> {
|
|
|
|
private final int capacity;
|
|
|
|
public LRUCache(int capacity) {
|
|
super(capacity, 0.75f, true);
|
|
this.capacity = capacity;
|
|
}
|
|
|
|
@Override
|
|
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
|
|
return size() > capacity;
|
|
}
|
|
|
|
}
|