Difference between ArrayList and LinkedList

Difference between ArrayList and LinkedList

ArrayListLinkedList
1. ArrayList is the best choice if our frequent operation is a retrieval operation.1. LinkedList is the best choice if our frequent operation is the insertion and deletion of elements in the middle.
2. ArrayList is the worst choice if our frequent operation is the insertion and deletion of elements in the middle because internally several shift operations are performed.2. LinkedList is the worst choice if our frequent operation is a retrieval operation.
3. In ArrayList the elements are stored in a consecutive memory location, hence retrieval operation will become easy. 3. In LinkedList the elements are not stored in a consecutive memory location, hence retrieval operation will become complex.

Similar Java Tutorials

Leave a Comment