Question
Which practice avoids a common mistake with LRU Cache with LinkedHashMap?
- Ignore the LRU Cache with LinkedHashMap issue and rely on team discipline instead of APIs or contracts.
- Silence the LRU Cache with LinkedHashMap problem by using raw types, broad catches, or shared mutable state.
- Do not describe LinkedHashMap as a complete production cache solution without considering concurrency, metrics, and eviction policy details.
- Prefer the version of LRU Cache with LinkedHashMap that makes behavior less predictable as long as the code compiles.
Hint
Look for the option that protects correctness instead of hiding the problem.
Answer and rationale
Correct answer: C. Do not describe LinkedHashMap as a complete production cache solution without considering concurrency, metrics, and eviction policy details.
Do not describe LinkedHashMap as a complete production cache solution without considering concurrency, metrics, and eviction policy details. This is a common failure mode in real Java code and a frequent interview follow-up.
Track: Java