This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

LinkedList and ArrayList

 
Devi Hari
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference between LinkedList and ArrayList
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are different implementations of the List interface.

LinkedList works with a linked list behind the scenes. ArrayList works differently, it has an array behind the scenes.

For some operations, ArrayList is more efficient (such as lookups by index), and for other operations, LinkedList is more efficient (such as inserting or deleting entries).

Read the API documentation of ArrayList and LinkedList for more information.

If you have trouble choosing between the two, analyze your application and find out what kind of operations you're doing on your list. Choose the implementation that does the most frequently used operations the most efficiently.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Devi --

First, a bit of business: you may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. A single name isn't enough. You can change your display name here. Thanks!

Second, this is a beginner question, not an advanced one; I'm moving this thread to Java in General (Beginner) for any follow-up.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic