mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-29 04:55:15 +00:00
19 lines
361 B
Java
19 lines
361 B
Java
|
package org.thoughtcrime.securesms.util;
|
||
|
|
||
|
import java.util.LinkedHashMap;
|
||
|
import java.util.Map;
|
||
|
|
||
|
public class LRUCache<K,V> extends LinkedHashMap<K,V> {
|
||
|
|
||
|
private final int maxSize;
|
||
|
|
||
|
public LRUCache(int maxSize) {
|
||
|
this.maxSize = maxSize;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
protected boolean removeEldestEntry (Map.Entry<K,V> eldest) {
|
||
|
return size() > maxSize;
|
||
|
}
|
||
|
}
|