mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-11 18:54:21 +00:00
9939830551
1) Refactor recipient class to support asynchronous loading operations. 2) Refactor recipient factory to simplify recipient access. 3) Consoliate everything into one recipient provider that is capable of doing async lookups and intelligent caching.
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;
|
|
}
|
|
}
|