未验证 提交 fa803c94 编写于 作者: Q Qimiao Chen 提交者: GitHub

Polish Javadoc in LRUCache

上级 70d7136f
......@@ -62,10 +62,14 @@ class LRUCache<K, V> extends LinkedHashMap<K, V> {
CACHE_SIZE = cacheSize;
}
/**
* 钩子方法,通过put新增键值对的时候,若该方法返回true
* 便移除该map中最老的键和值
*/
@Override
protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
// 当 map中的数据量大于指定的缓存个数的时候,就自动删除最老的数据。
return size() > CACHE_SIZE;
}
}
```
\ No newline at end of file
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册