HashMap vs ArrayList performance am I correct

Viewed 80243

I currently believe that:

  • When you need a structure from which you will be retrieving items randomly - use a HashMap
  • When you will be retrieving items in order (e.g. using a for loop) - use an ArrayList

Am I generally correct? Are there situations where this is not correct?

6 Answers
Related