Arraylist vs LinkedList Java
ArrayList Vs LinkedList:
1. Search operation is faster, because it maintains the array structure, so get(index) will search and give the value fastly.
2. Less memory consumption because it maintains element and data. Where in linkedlist it maintains two pointer to store the addresses of the neighbour elements.
1. Remove operation is faster.
2. Insertion operation is faster.
Because it is doubly linked list, so maintains both the address, where as in arraylist it need to shift the deleted area with the neighbour values.
When to use ArrayList:
Arraylist is recommended if we use search operation more. (get(index) function).
When to use LinkedList:
LinkedList is recommended if we use add/remove operations more. (add() and remove() function).
1,072 total views, 3 views today