14
this.cache = new LinkedHashMap<String, Integer>(CACHE_MAX_SIZE, 0.75f, true) {15
protected boolean removeEldestEntry(16
Map.Entry<String, Integer> eldest) {17
// Remove the eldest entry if the size of the cache exceeds the
18 // maximum size
19return size() > CACHE_MAX_SIZE;20
}
21};22
}
Read full article from Java Blog» Creating a simple cache in Java using a LinkedHashMap and an Anonymous Inner Class
No comments:
Post a Comment