LinkedHashMap vs HashMap != LinkedList vs ArrayList
Posted
by Markos Fragkakis
on Stack Overflow
See other posts from Stack Overflow
or by Markos Fragkakis
Published on 2010-03-08T21:14:45Z
Indexed on
2010/03/08
21:36 UTC
Read the original article
Hit count: 842
I have read that LinkedHashMap has faster iteration speed than HashMap because its elements are doubly linked to each other. Additionally, because of this, LinkedHashMap is slower when inserting or deleting elements. Presumably because these links also need to be updated.
Although I can see an analogy to LinkedList vs ArrayList, in that the elements of LinkedList are also doubly-linked, I read that it iterates slower than ArrayList, and has faster insertion and deletion times.
Why is this? Perhaps I am making a mistake somewhere?
Cheers1
© Stack Overflow or respective owner