ArrayList and LinkedList both implements List Interface and maintenance insertion order and both are non synchronized classes. Here are the differences:
Point of Difference | ArrayList | LinkedList |
---|---|---|
How elements are stored? | Internally uses a dynamic array to store the elements. | Internally uses a doubly linked list to store the elements. |
Manipulation Speed | Slow because it internally uses an array. If any element is removed from the array, all the bits are shifted in memory. | Faster than ArrayList because it uses a doubly linked list, so no bit shifting is required in memory. |
When to use? | better for storing and accessing data. | better for manipulating data |
Act As | act as a list only because it implements List only | act as a list and queue both because it implements List and Deque interfaces. |