Search code examples
javaandroidlru

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 sdcard .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


Solution

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