summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/util/LruCache.java7
2 files changed, 6 insertions, 2 deletions
diff --git a/api/current.txt b/api/current.txt
index 66b76bb..fe16ee5 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22791,6 +22791,7 @@ package android.util {
method protected int sizeOf(K, V);
method public final synchronized java.util.Map<K, V> snapshot();
method public final synchronized java.lang.String toString();
+ method public void trimToSize(int);
}
public final class MalformedJsonException extends java.io.IOException {
diff --git a/core/java/android/util/LruCache.java b/core/java/android/util/LruCache.java
index 51e373c..dd504c1 100644
--- a/core/java/android/util/LruCache.java
+++ b/core/java/android/util/LruCache.java
@@ -186,10 +186,13 @@ public class LruCache<K, V> {
}
/**
+ * Remove the eldest entries until the total of remaining entries is at or
+ * below the requested size.
+ *
* @param maxSize the maximum size of the cache before returning. May be -1
- * to evict even 0-sized elements.
+ * to evict even 0-sized elements.
*/
- private void trimToSize(int maxSize) {
+ public void trimToSize(int maxSize) {
while (true) {
K key;
V value;