What is difference between LinkedList and ArrayList | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is difference between LinkedList and ArrayList

28th Jun 2019, 4:47 PM
Sandeep
Sandeep - avatar
2 Answers
+ 11
ArrayList and LinkedList both implements List interface and maintains insertion order. ... LinkedList internally uses a doubly linked list to store the elements. 2) Manipulation with ArrayList is slow because it internally uses an array. If any element is removed from the array, all the bits are shifted in memory.
28th Jun 2019, 4:52 PM
Muaz Ahmad
Muaz Ahmad - avatar
+ 4
performance ArrayList + : get(), set(), "large number of random access of element" LinkedList+ : remove(), add() + "ArrayList is a better choice if your program is thread-safe. " - "ArrayList grow 50% of its size each time." (default size is 10, it can be trimmed manually) "LinkedList adds more methods" benchmark: add: ArrayList 13,265,642 LinkedList 9,550,057 get: ArrayList 1,543,352 LinkedList 85,085,551 remove ArrayList 199,961,301 LinkedList 85,768,810 https://dzone.com/articles/arraylist-vs-linkedlist-vs
28th Jun 2019, 6:21 PM
zemiak