Skip to content

Commit 6a916ed

Browse files
jsharkeyAndroid (Google) Code Review
authored andcommitted
Merge "Add trimToSize() to public API." into jb-mr1-dev
2 parents 3a68038 + d96b585 commit 6a916ed

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
@@ -22791,6 +22791,7 @@ package android.util {
2279122791
method protected int sizeOf(K, V);
2279222792
method public final synchronized java.util.Map<K, V> snapshot();
2279322793
method public final synchronized java.lang.String toString();
22794+
method public void trimToSize(int);
2279422795
}
2279522796

2279622797
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)