| Author |
When do we use ArrayList, Vector and LinkedList
|
jose chiramal
Ranch Hand
Joined: Feb 12, 2010
Posts: 266
|
|
ArrayList : when we need fast iteration
Vector : when we need thread safety since Vector methods are synchronised by default.
LinkedList: when do we use linkedlist ??
Also any practical examples, where we could use each of the above ?
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
ArrayList is fast in random access. If I want to get the 8th element then the 3rd element then the 7th and then the 2nd element, ArrayList will provide the best performance. LinkedList is slow in random access
LinkedList is used when you modify the list a lot. If you'll add and remove elements to the List a lot of times, LinkedList should be used. ArrayList is slow in terms of additions and removal...
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
 |
|
|
subject: When do we use ArrayList, Vector and LinkedList
|
|
|