开发者

Android : Least recently used (LRU) algorithm implementation in java?

开发者 https://www.devze.com 2023-02-11 09:07 出处:网络
In my application am having lot bitmaps around 1000. I have tomerge them as a single image. In order to do this , loading currently needed bitmaps from sd开发者_Python百科card .In this process i have

In my application am having lot bitmaps around 1000. I have to merge them as a single image. In order to do this , loading currently needed bitmaps from sd开发者_Python百科card .In this process i have to recyle Least recently used bitmaps other wise dvm throws out of memory error . so can any one tell me how to accomplish this task (Least recently used ) in java.??

Thank you, Srinivas


LinkedHashMap would be perfect fit for this type of problems.removeEldestEntry() method of LinkedHashMap class returns true to remove oldest entry


You may want to look into the LinkedHashMap or LinkedHashSet implementations in the Collections API, which provide support for a highly-configurable LRU framework.

0

精彩评论

暂无评论...
验证码 换一张
取 消