...

/

LinkedHashMap: Internal Working

LinkedHashMap: Internal Working

Take a look at the internal workings of LinkedHashMap.

The internal workings of a LinkedHashMap are similar to the internal workings of HashMap with one major difference. In LinkedHashMap, each Entry maintains the record of the Entry that was inserted before it and after it.

If we look at the Entry class of LinkedHashMap, then we can see that it has two extra fields in comparison to the Entry class of HashMap. These extra fields are before and after. For a given Entry, the before field points to the Entry that was inserted prior to this Entry. The after ...