File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When do we use ArrayList, Vector and LinkedList

 
jose chiramal
Ranch Hand
Posts: 266
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic