• Post Reply Bookmark Topic Watch Topic
  • New Topic

Arraylist and Linkedlist  RSS feed

 
Vinay Tj
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anybody tell me when do we go for Arraylist and Linkedlist?

on what basis we use any one of this?

Regards,
Vinay
 
Pushkar Choudhary
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found this article on Sun Java site and another one. Hope that helps!
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ArrayList: When you're iterating over a list of data which required fast or constant time retrieval.
LinkedList: When you're a adding, removing and getting data from the list.
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you read their API documentation or the Java™ Tutorial?
Sagar Rohankar wrote:ArrayList: When you're iterating over a list of data which required fast or constant time retrieval.
See the RandomAccess interface. Quicker for adding at the end, finding elements in the middle, etc.
LinkedList: When you're a adding, removing and getting data from the list.
Quicker for adding and removing in the middle or beginning, but slower for finding elements in the middle. Better for Queue use, but see the ArrayDeque class too.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!