aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Exact Difference Between LinkedList and ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Exact Difference Between LinkedList and ArrayList" Watch "Exact Difference Between LinkedList and ArrayList" New topic
Author

Exact Difference Between LinkedList and ArrayList

Pawar Santoshkumar
Greenhorn

Joined: Jul 03, 2006
Posts: 10
Can anybody tell me exact difference between Linked List and Array List.
Please give Example By Usage of Both in JavaCode.
Thanks in Advance.
Shaan Shar
Ranch Hand

Joined: Dec 27, 2005
Posts: 1249

Originally posted by pawar santosh:
Can anybody tell me exact difference between Linked List and Array List.
Please give Example By Usage of Both in JavaCode.
Thanks in Advance.


Well Pawar,
The biggest difference between is

LinkedList are meant for sequential accessing. ArrayList are meant for random accessing.

Although you can check out the books on Collections for time being I can tell you.

An Array is a "special" object in Java that has very few methods. You can access the value in the array the [ ] brackets, and you can determine the length (the .length) property, and thats about the extent of the Array. The array has a FIXED size that cannot be changed.

The ArrayList is part of the Collections Framework. It is a List that is built on top of an array. It provides methods to add to the list (thereby changing the size), as well as to obtain an iterator, and to remove elements, sort elements, and perform searches. Basically, it saves you from having to write that code when using an array.

The LinkedList is also a List. It essentially provides the same methods as the ArrayList, except the underlying data structure uses objects that contain references to other objects to form a list. This is "similar" to the concept other languages call "pointers" (but not quite the same).


I hope I make it clear you.


The Best way to predict your future is to create it - Every great individual common man
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
USING ARRAYLIST AND LINKEDLIST
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Exact Difference Between LinkedList and ArrayList