Tuesday, February 12, 2013

Difference between ArrayList vs LinkedList



  • Difference between ArrayList vs LinkedList 


1) Data Structure
ArrayList Array
LinkedList LinkedList

2) LinkedList implements Deque
LinkedLis implements deque and list interfaces

7) Memory
LinkedList uses a wrapper object, Entry,  which is a static nested class for storing data and two nodes next and previous while ArrayList just store data in Array. So memory requirement seems less in case of ArrayList than LinkedList except the case where Array performs re-size operation, when it copies content from one Array to another.
If Array is large enough it may take lot of memory at that point and trigger Garbage collection, which can slow response time.

http://java67.blogspot.com/2012/12/difference-between-arraylist-vs-LinkedList-java.html

No comments:

Post a Comment