am 6a916ed0: Merge "Add trimToSize() to public API." into jb-mr1-dev

* commit '6a916ed0c0f5c5c5ec53f11087265eb13fc34ff1':
  Add trimToSize() to public API.
This commit is contained in:
Jeff Sharkey
2012-08-01 14:50:02 -07:00
committed by Android Git Automerger
2 changed files with 6 additions and 2 deletions

View File

@@ -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 {

View File

@@ -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;