This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ArrayList vs LinkedList

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


i do not thing there is much different between ArrayList and LinkedList..


commonly we are using ArrayList..please can anyone tell me,in which scenario we go for LinkedList?

Thanks & Regards,
seetharaman.v
 
Marco Ehrentreich
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi seetharaman,

when you use ArrayList and LinkedList only as "List" interface there's indeed no big difference between them - regarding the API. But there's a big difference how they are implemented! Usually you shouldn't have to worry about the implementations of an interface but the different collection classes make a big difference regarding performance of one or another method. Some collections allow you very fast insertion other give you very fast indexed access and so on. So you should reasonably decide which collection implementation is best for you requirements because there's simply no algorithmic solution which is THE best for everything one can imagine.

You'll find more detailed information in API documentation of the classes.

Marco
[ June 02, 2008: Message edited by: Marco Ehrentreich ]
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Marco
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic