Skip to content

Commit d96b585

Browse files
committed
Add trimToSize() to public API.
Bug: 6602490 Bug: http://code.google.com/p/android/issues/detail?id=35349 Change-Id: Ib3bc7fee05bb0edc375ebee1c40a1d7bd82e2a17
1 parent 24d19fb commit d96b585

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

api/current.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22776,6 +22776,7 @@ package android.util {
2277622776
method protected int sizeOf(K, V);
2277722777
method public final synchronized java.util.Map<K, V> snapshot();
2277822778
method public final synchronized java.lang.String toString();
22779+
method public void trimToSize(int);
2277922780
}
2278022781

2278122782
public final class MalformedJsonException extends java.io.IOException {

core/java/android/util/LruCache.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,13 @@ public final V put(K key, V value) {
186186
}
187187

188188
/**
189+
* Remove the eldest entries until the total of remaining entries is at or
190+
* below the requested size.
191+
*
189192
* @param maxSize the maximum size of the cache before returning. May be -1
190-
* to evict even 0-sized elements.
193+
* to evict even 0-sized elements.
191194
*/
192-
private void trimToSize(int maxSize) {
195+
public void trimToSize(int maxSize) {
193196
while (true) {
194197
K key;
195198
V value;

0 commit comments

Comments
 (0)