p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Java Basics (http://p2p.wrox.com/forumdisplay.php?f=199)
-   -   diff between arraylist and linkedlist (http://p2p.wrox.com/showthread.php?t=61618)

anwarraja August 30th, 2007 02:41 AM

diff between arraylist and linkedlist
 
hi what a diffrence between arrylist and linked list ?


iamrakesh22 September 4th, 2007 06:34 AM

Both extends AbstractList.

- Rakesh

ciderpunx September 6th, 2007 11:39 AM

You can use a LinkedList to implement a stack or queue, because each element is linked both to its predecessor and to its successor.

see:

http://java.sun.com/j2se/1.4.2/docs/...ArrayList.html
http://java.sun.com/j2se/1.4.2/docs/...inkedList.html

--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk

neo.isbackin.thematrix September 11th, 2007 04:32 AM

Hi,

Well, the difference between an ArrayList and LinkedList is between the Algorithm used to construct both.

As the name suggests, LinkedList uses 'LinkedList' Algorithm which is Doubly LinkedList. So it every element in it is connected to its previous element and next element which is not the case in ArrayList.

The usage of them is suggested dependending upon the design of ur code. Like Traversal and Addition is faster in the case of ArrayList than LinkedList but Deletion of one element is Faster in case of LinkedList. So depending upon your requirement, you can use them.



All times are GMT -4. The time now is 12:32 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.