ArrayList implements only List interface, where as LinkedList implements List, Queue, and Deque interfaces.
ArrayList is internally an implementation of an array which is dynamic in nature, where as LinkedList is internally a double-ended linked list
with each element maintaining links to its left and right neighbours.
ArrayList supports faster search and iteration of elements than LinkedList, because ArrayList is internally an array maintaining the indexes of its elements which are stored contiguously in the memory
whereas, in LinkedList elements need not be stored contiguously in the memory, hence search in LinkedList results in traversing the entire linked list starting from the first element at its beginning
and then moving on to next linked element which could be at some other memory location.
Advertisement
ArrayList supports slower insertion and deletion of elements than LinkedList, because if a new element is inserted
in an ArrayList, the rest of elements after it are shifted down and when an element is deleted, the rest of element after the deleted element are shifted up.
Where as in LinkedList elements are doubly-linked to one another, hence, no such shifting of elements takes place when an element is inserted or deleted but only the links between a few elements are modified.
,
As ArrayList is not a double-ended storage, hence, it does not provide a direct method for insertion and deletion of an element
at its beginning, whereas, LinkedList being a double-ended storage, provides direct methods for insertion and deletion of an element
not just at its end but even at its beginning.