Codelytics

Visualise your geek speak

  • Blog
  • Terms
  • Privacy
  • Contact

LinkedHashMap Tutorial

September 9, 2018 by Adrian Bartlett Leave a Comment

java.util.LinkedHashMap stores Key Value pairs like java.util.HashMap, and enables the retrieval of a Value given a Key.  LinkedHashMap differs from HashMap in that the Keys are ordered by their insertion order. LinkedHashMap maintains a double-linked list to determine insertion order.

This tutorial, complete with an easy to understand and interactive UML visualization, explains how LinkedHashMap works.

This is the fifth part in our java.util.Map series. Read the following prerequisite post first, before continuing with this post:

  • Hashmap Introduction Tutorial
  • Hashmap and the Importance of HashCode

Step through LinkedHashMap in action

Step through the visualisation from the above image, and read the yellow comments and the associated code.

When the code is executed, the following is output. Note how the results are in the same order as they were inserted.

Last Name     First Name    Rating
---------------------------------
Smith         Bill          5
Smith         Jack          4
Jackson       Bill          2
Smith         Andrew        1

Do you like this Codelytics’ visualization?

If you like our visualizations, be sure to subscribe to our  mailing list below.  With your free subscription, we will periodically send you alerts about new tutorials and visualizations posted here.

Share this:

  • Click to email this to a friend (Opens in new window)
  • Click to print (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Google+ (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)

Filed Under: Collections, Java Tagged With: Collections, Hashmap, Hashmap Tutorial, Java, java.util.Map series, LinkedHashMap

Connect with us

  • Facebook
  • Google+
  • Twitter
  • YouTube

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Facebook
  • Google+
  • Twitter
  • YouTube

Subscribe to the blog

Recent posts

  • LinkedHashMap Tutorial
  • java.util.TreeMap visualized: interactive view from a new perspective
  • Constructor & Setter Dependency Injection
  • 4 Reasons to use a Java Semaphore
  • Java 8: How To Retrieve Absent Values From HashMap

Search

  • Blog
  • Terms
  • Privacy
  • Contact

All website content, including software, (excluding that owned by Wordpress and Centric Theme on Genesis Framework) is owned by Codelytics Pty Ltd and/or its affiliates, all rights reserved and protected by Australian copyright laws and relevant international treaty provisions. Any reproduction, redistribution and/or reverse engineering is expressly prohibited. For further details see the terms and conditions page on this site.
© Codelytics Pty Ltd, Adrian Bartlett, 2013

Copyright © 2022 · Centric Theme on Genesis Framework · WordPress · Log in

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.