• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

What is the Difference?

 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May i know what is the difference between ArrayList and LinkedList? both are not synchronized !

Please help me
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
LinkedList implements the Queue interface, whereas ArrayList does not. ArrayList implements RandomAccess, though (which LinkedList does not). The javadocs of both classes talk some more about their respective advantages and disadvantages.
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ArrayList is backed by an array. A LinkedList is a http://en.wikipedia.org/wiki/Linked_list. Once built, accessing elements by index from an ArrayList is much faster. For volatile lists, LinkedList is better. When building an ArrayList, make note of the ArrayList(int) constructor -- using that is important when creating large lists. :-)
 
Ranch Hand
Posts: 449
Scala IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aditi Gandy wrote:May i know what is the difference between ArrayList and LinkedList? both are not synchronized !


Same discuss here
Also see Deque which is double-ended queue.

The Deque interface extends from the Queue interface introduced with Java 5, and is the latest addition to the Java Collections Framework. Implementations of the interface include LinkedList, ArrayDeque and LinkedBlockingDeque.




 
catch it before it slithers away! Oh wait, it's a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic