I was going through the differences between Array List and Linked List implementations of the List interface in Java. Almost all resources, I went through told that Array Lists provide better performanceO(1)
for Index Based Operations(Searching etc.) and require shifting of elements (or copying in this case) for insertions and deletions.On the other hand, Linked lists are better for Insertions and deletions as it requires just the change of the references and instantiation of the Node object.
Then I came across this one article which stated
In most cases, however, ArrayList outperforms LinkedList. Even elements shifting in ArrayList, while being an O(n) operation, is implemented as a very fast System.arraycopy() call. It can even appear faster than the LinkedList‘s O(1) insertion which requires instantiating a Node object and updating multiple references under the hood. LinkedList also can have a large memory overhead due to a creation of multiple small Node objects.
This made me think that if the copying of the elements for insertion/deletion(in ArrayList) can be faster than the instantiation of node and subsequent change of references(in LinkedList), then Array List should outperform Linked List for each use case. Now My question is that if this is true then what are the use cases for the Linked Lists? Please enlighten me if this premise is wrong