in Core Java

What is LinkedHashMap?

LinkedHashMap and How to use it as LRU Cache?

Linked HashMap is a datastructure
Which maintains the insertion order for its entries. That means it arranges its entries exactly in the same order as
they have been added. LinkedHashMap can be used in the scenarios where the First in first out kind of data model is needed.

LinkedHashMap can also maintain the access order for its entries where it moves all recently accessed entries to the bottom of the collection.

This kind of feature is useful in making LRU (Least Recently Used) caching mechanisms.

LinkedHashMap example code:

 

Srinivas Reddy

Srinivas Reddy

An IT - Specialist with loads of experience in Java, J2ee platforms and loves to share his experience on technology with You...

More Posts - Website

Follow Me:
TwitterFacebook

Srinivas Reddy
Written By:

An IT - Specialist with loads of experience in Java, J2ee platforms and loves to share his experience on technology with You...