| |
|
Difference between ArrayList and LinkedList Question Posted on 18 Sep 2019 Home >> Java >> Core Java >> Difference between ArrayList and LinkedList |
Difference between ArrayList and LinkedList
Below are the 4 main difference between ArrayList vrs LinkedList
(1) ArrayList uses a dynamic array to store the elements internally. On the other hand LinkedList uses a doubly linked list to store the elements internally.
(2) ArrayList is better when we are storing and accessing data. On the other hand LinkedList is better for manipulating data.
(3) If we do Manipulation with ArrayList it is very slow because it internally uses an array. If we remove any element from the array, all the bits are shifted in memory. On the other hand Manipulation with LinkedList is faster than ArrayList because it uses a doubly linked list, so no bit shifting is required in memory.
(4) An ArrayList class can act as a list only because it implements List only. LinkedList class can act as a list and queue both because it implements List and Deque interfaces. | |
|
|
|
|