If you take a look at the code for HashMap, you'll find empty methods called recordAccess and recordRemoval. What's the purpose开发者_JS百科 of these methods?
They are overridden in LinkedHashMap
's Entry
in order to maintain its linked list of entries.
It looks like the methods serve no direct purpose. However, if you were subclassing HashMap
you could subclass the backing HashMap.Entry
as well to receive such events easily.
精彩评论