How to implement or use LRU cache if already present in Java
<p>I want a LRU cache that contains <code>&lt;String, FileName&gt;</code> with some basic features  </p>

<ul>
<li><p>when it removed Least recently used entry, it should closed file.</p></li>
<li><p>Cache should be able to handle multiple thread request.</p></li>
</ul>

<p>I know that, we can use <strong>LinkedHashMap</strong> as a LRU cache by overriding <strong>removeEldestEntry</strong> method. But i want to close the file once it will be removed during new entry. It there any way we can achieved this?</p>