HashMap Entry类的recordAccess()方法是空体

ans*_*tta 1 java collections hashmap

API有这样的评论..

但是它做了什么?既然它有空身方法.

/**
 * This method is invoked whenever the value in an entry is
 * overwritten by an invocation of put(k,v) for a key k that's already
 * in the HashMap.
 */
void recordAccess(HashMap<K,V> m) {
}
Run Code Online (Sandbox Code Playgroud)

Sti*_*sis 6

存在被子类覆盖.访问记录时调用它.在LinkedHashMap子类中重写此方法,并使用它来频繁访问的记录移动到链接列表的前面.