What is the difference between array list and linked list. in which situations we are use them? which is best one?

Questions by sadashivarao   answers by sadashivarao

Showing Answers 1 - 4 of 4 Answers

Shrikrishna

  • Aug 11th, 2006
 

public class ArrayList
extends AbstractList
implements List, RandomAccess, Cloneable, Serializable

Resizable-array implementation of the List interface. Implements all optional list operations, and permits all elements, including null. In addition to implementing the List interface, this class provides methods to manipulate the size of the array that is used internally to store the list. (This class is roughly equivalent to Vector, except that it is unsynchronized.)

public class LinkedList
extends AbstractSequentialList
implements List, Cloneable, Serializable

Linked list implementation of the List interface. Implements all optional list operations, and permits all elements (including null). In addition to implementing the List interface, the LinkedList class provides uniformly named methods to get, remove and insert an element at the beginning and end of the list. These operations allow linked lists to be used as a stack, queue, or double-ended queue (deque).

  Was this answer useful?  Yes

Kris

  • Jan 28th, 2007
 

Also, Linked Lists perform better since, to grow, one only need add a node and adjust some 'pointers'ArrayList objects are supported by an underlying array (hence the name), thus, to grow, the ArrayList (under the covers) creates a new array (150% the size of the original array), copies all the values to the new array and switches to the new array

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions