What is the difference between HashMap and LinkedHashMap? - ProProfs Discuss
Advertisement

What is the difference between HashMap and LinkedHashMap?

What is the difference between HashMap and LinkedHashMap?

Change Image    Delete

Asked by R. Jones, Last updated: Nov 09, 2024

+ Answer
Request
Question menu
Vote up Vote down

1 Answer

Peyton Berrymore

Peyton Berrymore

Art is the only thing that I love about this world, I love how everything is an art and there's so much more t explore so I keep searching for it.

Peyton Berrymore
Peyton Berrymore, Artist, Bachelor of Fine Arts (BFA), Nashville, Tennessee

Answered Apr 13, 2020

The main difference between HashMap and Linked HashMap is the order. HashMap is more random and lacking sensible order, while LinkedHashMap is in key insertion order, which is the order that the keys are inserted in the map.

HashMap is one of the most traditional and includes the four general-purpose implementations of the Map interface in Java based on the hashing algorithm. HashMap offers constant time performances for put and get. The class is not thread-safe but allows one null key and multiple null values. It does not maintain a particular order; it involves less memory. LinkedHashMap is part of the HashMap class, so its features are the same.

upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

Email Sent
We have sent an email to your address "" with instructions to reset your password.