Forums Register Login

ArrayList vs LinkedList !!

+Pie Number of slices to send: Send
What are the differences between an ArrayList and a LinkedList ?
Where do we use ArrayList and where LinkedList ?
+Pie Number of slices to send: Send
ArrayList is implemented with an array to store the elements of the list. LinkedList is implemented as a doubly-linked list.

Which one you should use depends on how you use the list. An ArrayList is faster when you need to lookup an element at a known index in the list, but slower when you insert elements in the list. A LinkedList is slower when looking up an element at a known index in the list, but faster when you insert elements in the list.
+Pie Number of slices to send: Send
Adding on top of what Jesper said, both of them are collections and used to deal with a heterogeneous elements in a sequence.

As they follow different implementation strategies, they have different characteristics. I think Jesper have given a good explanation on that.
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
 

Originally posted by Amir Alagic:
http://narencoolgeek.blogspot.com/2006/09/arraylist-vs-linkedlist.html



This link is cool (also the links present inside the article).
+Pie Number of slices to send: Send
ArryList: we will use ArrayList in following cases
if the requirement contains more retrival operation then we have to use ArrayList

LinkedList: If the requirement contains more insertions and deletions then we will use LinkedList
+Pie Number of slices to send: Send
 

Originally posted by raghu nagabandi:
ArryList: we will use ArrayList in following cases
if the requirement contains more retrival operation then we have to use ArrayList



Only for random access. If we always iterate through all elements of a list in order, a LinkedList should be just fine (although still a little bit slower).
You may have just won ten million dollars! Or, maybe a tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1111 times.
Similar Threads
LinkedList and ArrayList
Difference between ArrayList and LinkedList?
iterating over a LinkedList or ArrayList
What is the difference between LinkedList and ArrayList ?
HashSet question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:03:43.