What is the Difference Between an ArrayList and a LinkedList Data Structure in Java ?

Main differences between ArrayList and LinkedList data structures are...

Data Structure : An ArrayList is an indexed based dynamic array. A LinkedList is a Doubly Linked List data structure.

Insertion : It is easier to insert new elements in a LinkedList, since there is no need to resize an array. Insertion in ArrayList is O(n), since it may require resizing of array and copying its contents to new array.

Remove elements : LinkedList has better performance in removal of elements than ArrayList.

Memory Usage : LinkedList uses more memory than ArrayList, since it has to maintain links for next and previous nodes as well.

Access : LinkedList is slower in accessing an element, since we have to traverse the list one by one to access the right location.



You May Interest

What is the Advantage of Using Unicode Characters in Java ?

What are the Main Benefits of Collections Framework in Java ?

When Will You Use Strategy Design Pattern in Java ?

What is the Lifecycle Stages of JSP ?

What is String Interning in Java ?