Reputation: 5006
I would like to use Android's LruCache in my plain old non-Android Java projects. Is there an equivalent data structure in regular Java or do I have to roll out my own implementation?
Upvotes: 0
Views: 108
Reputation: 59204
In regular Java you can do it with a LinkedHashMap
, using the 3-argument constructor to make it access-ordered, and overriding removeEldestEntry
to expire entries.
Upvotes: 1