AlgoMaster Logo

LinkedHashMap

Last Updated: June 6, 2026

High Priority
10 min read

LinkedHashMap is a HashMap that remembers the order in which entries were added. It provides the same average O(1) get and put as HashMap, while iteration walks the entries in a predictable order rather than the scrambled bucket order a plain HashMap produces. It also has a second mode, access order, which fits building a small LRU cache. This lesson covers both modes, the doubly-linked list that makes them work, how to bound the size by overriding removeEldestEntry, and when picking LinkedHashMap over HashMap or TreeMap is appropriate.

Premium Content

Subscribe to unlock full access to this content and more premium articles.