LinkedHashMap in java with example

Previous
Next

In this post, we will see about LinkedHashMap in java. LinkedHashMap is same as HashMap except that it maintains insertion order.

Some points about LinkedHashMap

  1. LinkedHashMap implements Map interface and extends HashMap class.
  2. LinkedHashMap maintains insertion order, so when you will be able to access elements in the order they were inserted like ArrayList.
  3. LinkedHashMap maintains doubly Linked list to maintain insertion order.

Example:

LinkedHashMapMain.java

If you may iterate LinkedHashMap in multiple ways.
When you run above program, you will get below output:

Previous
Next

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.

Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog