开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜