Saturday, 10 December 2016

What is Difference between ArrayList and LinkedList in Java ?


Here we will discuss all the differences between ArrayList and LinkedList in Java.


ArrayList
LinkedList
It maintains the insertion order of elements.
It maintains the insertion order of elements.
ArrayList internally uses dynamic array to store the element.
LinkedList internally uses doubly linked list to store the element.
Data manipulation is slow.
Data manipulation is fast.
ArrayList is better for storing and accessing elements.
LinkedList is better for manipulating elements.
ArrayList performs index based search.
LinkedList iterates either from beginning or end to retrieve the node.
To traverse ArrayList in reverse direction we have to write our own code.
LinkedList have descendingIterator() method to traverse in reverse direction.
Initial capacity of ArrayList is 10.
LinkedList don’t have any initial capacity.


     
Blog Author - Pushkar Khosla,
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.

This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.



3 comments:

  1. List maintains the insertion order. As ArrayList and LinkedList implements List interface both should maintain the insertion order. Can you cross check the ArrayList insertion order point.

    ReplyDelete
  2. Hi man,
    I have cross checked your point and you are right.

    ReplyDelete
  3. I will make sure every point while writing in future.

    ReplyDelete