Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3
Arraylists use arrays to store values. Arrays can no change their size after creation. When you add items in arraylist: ~Array list creates new array with new size. ~Array list copies it's old items and adds the new items to the new array. ~Array list deletes the old array. Linkedlists store a link with each stored item, when you iterate through linked list, iteration naturally starts from the first item, then it uses the link of the second item to catch the second item, and link of the third item to catch the fourth item, same carousel until each item is iterated through. When you add an item to linked list: ~Linked list will store new item's address to the so far last item's link place. Like SoloLearn's tutorial said, their only difference is on how they store values.
23rd Sep 2019, 5:23 PM
Seb TheS
Seb TheS - avatar