Android LruCache snapshot resize forEach,Kotlin

Android LruCache snapshot resize forEach,Kotlin

        var size = 5
        val cache = android.util.LruCache>(size)
        cache.put("a", WeakReference("1"))
        cache.put("b", WeakReference("2"))
        cache.put("c", WeakReference("3"))
        cache.put("d", WeakReference("4"))
        cache.put("e", WeakReference("5"))

        cache.snapshot().forEach { (t, u) ->
            Log.d(TAG, "$t ${u.get()} forEach(t,u)")
        }

        cache.snapshot().entries.forEach {
            Log.d(TAG, "${it.key} ${it.value.get()} forEach")
        }

        cache.resize(size - 2)

        cache.snapshot().values.forEachIndexed { index, weakReference ->
            Log.d(TAG, "$index ${weakReference.get()} forEachIndexed")
        }

Android LruCache snapshot resize forEach,Kotlin_第1张图片

Android LruCache & DiskLruCache cooperate working in ListView_android listview disklrucache_zhangphil的博客-CSDN博客package zhangphil.cache;import android.app.ListActivity;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.support.annotation.NonNull;import android.support.anno_android listview disklrucachehttps://blog.csdn.net/zhangphil/article/details/78156800使用新式LruCache取代SoftReference缓存图片,Android异步加载图片_zhangphil的博客-CSDN博客import java.io.InputStream;import java.net.URL;import java.io.InputStream;import java.net.URL;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.os.Hanhttps://blog.csdn.net/zhangphil/article/details/43667415Android二级缓存之物理存储介质上的缓存DiskLruCache_zhangphil的博客-CSDN博客Android二级缓存之物理存储介质上的缓存DiskLruCacheAndroid DiskLruCache属于物理性质的缓存,相较于LruCache缓存,则DiskLruCache属于Android二级缓存中的最后一级。通常Android缓存分为两级,第一级是内存缓存,第二级是物理缓存也即DiskLruCache。顾名思义,DiskLruCache就是将数据缓存到Android的物理https://blog.csdn.net/zhangphil/article/details/51888974基于Java LinkedList,实现Android大数据缓存策略_zhangphil的博客-CSDN博客import java.util.HashMap;import java.util.LinkedList;/* * 基于Java LinkedList,实现Android大数据缓存策略 * 作者:Zhang Phil * 原文出处:http://blog.csdn.net/zhangphil * * 实现原理:原理的模型认为:在LinkedList的头部元素是最旧的缓存数据,在L_android大数据缓存https://blog.csdn.net/zhangphil/article/details/44116885

Android LruCache in ListView_zhangphil的博客-CSDN博客package zhangphil.cache;import android.app.ListActivity;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.support.annotation.NonNull;import android.support.annohttps://blog.csdn.net/zhangphil/article/details/78152851使用Android新式LruCache缓存图片,基于线程池异步加载图片_zhangphil的博客-CSDN博客import java.io.BufferedInputStream;import java.io.ByteArrayOutputStream;import java.io.InputStream;import java.net.HttpURLConnection;import java.net.URL;import java.util.concurrent.ExecutorServichttps://blog.csdn.net/zhangphil/article/details/44082287

你可能感兴趣的:(kotlin,Android,android,kotlin)