package org.simpleframework.xml.util; import java.util.LinkedHashMap; import java.util.Map; /* loaded from: classes.dex */ public class LimitedCache extends LinkedHashMap implements Cache { private final int capacity; public LimitedCache() { this(50000); } public LimitedCache(int i) { this.capacity = i; } @Override // org.simpleframework.xml.util.Cache public void cache(Object obj, T t) { put(obj, t); } @Override // org.simpleframework.xml.util.Cache public T take(Object obj) { return remove(obj); } @Override // org.simpleframework.xml.util.Cache public T fetch(Object obj) { return get(obj); } @Override // org.simpleframework.xml.util.Cache public boolean contains(Object obj) { return containsKey(obj); } @Override // java.util.LinkedHashMap protected boolean removeEldestEntry(Map.Entry entry) { return size() > this.capacity; } }