• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LinkedXXX vs XXX iteration speed

 
Andre Enimot
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
K&B 6 book ch 7:

p. 562: "...LinkedList may iterate more slowly then an ArrayList"
p. 564: "...you can expect faster iteration with a LinkedHashMap" (compared to HashMap)

So do LinkedXXX provide slower or faster iteration compared to XXX? I'd expect the trend be the same for Lists and Maps?
 
Ankit Garg
Sheriff
Posts: 9519
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd expect the trend be the same for Lists and Maps?

Why?? Lists and Maps are two completely different things. Iteration speed depends on the implementation of a collection. It doesn't has to do anything with names (LinkedXXX or XXX)...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic