3

If you take a look at the code for HashMap, you'll find empty methods called recordAccess and recordRemoval. What's the purpose of these methods?

2 Answers 2

9

They are overridden in LinkedHashMap's Entry in order to maintain its linked list of entries.

0

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.

1
  • Looks like they do have a direct purpose (ref: axtavt's answer).
    – Andy
    Feb 7, 2011 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.