LearnFrenzy
Sign in Take a free test

HashMap and TreeMap · HashMap and TreeMap MCQ · Question 12

Building an LRU cache Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 12 Back to Exercise

Which method do you override in LinkedHashMap to evict old entries automatically?

  • A removeOldest()
  • B removeEldestEntry(Map.Entry) Correct
  • C evict()
  • D trimToSize()
Correct Answer: Option B

Return true when size() exceeds the capacity.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links