Example usage for android.support.v4.util LruCache snapshot

List of usage examples for android.support.v4.util LruCache snapshot

Introduction

In this page you can find the example usage for android.support.v4.util LruCache snapshot.

Prototype

public synchronized final Map<K, V> snapshot() 

Source Link

Document

Returns a copy of the current contents of the cache, ordered from least recently accessed to most recently accessed.

Usage

From source file:org.schabi.newpipe.util.InfoCache.java

private static void removeStaleCache(@NonNull final LruCache<String, CacheData> cache) {
    for (Map.Entry<String, CacheData> entry : cache.snapshot().entrySet()) {
        final CacheData data = entry.getValue();
        if (data != null && data.isExpired()) {
            cache.remove(entry.getKey());
        }//from  w  ww. j a  v  a2 s . c o m
    }
}