In my program I often use collections to store lists of objects. Currently I use ArrayList to store objects.
My question is: is this a best choice? May be its better to use LinkedList? Or something else?
Criteria to consider are:
- Memory usage
- Performance
Operations which I need are:
- Add element to collection
- Iterate through the elements
Any thoughts?
Update: my choice is : ArrayList 🙂 Basing on this discussion as well as the following ones:
I always default to ArrayList, and would in your case as well, except when
As to what to pick in that second case, this SO.com thread has some useful insights: List implementations: does LinkedList really perform so poorly vs. ArrayList and TreeList?