Answer to Question #48015 in Java | JSP | JSF for javabegin

Question #48015
How different between LinkedList and ArrayList ? In which case we use each of them LinkedList or ArrayList?
1
Expert's answer
2014-10-22T14:17:17-0400
ArrayList is that former is backed by an array while later is based upon LinkedList linked list data structure. The performance of add(), remove(), contains() and iterator() different for both ArrayList and LinkedList. You should use LinkedList in Java if:
• Your application can live without random access. Because if you need n-th element in LinkedList you need to first traverse up to n-th element O(n) and than you get data from that node.
• Your application is more insertion and deletion driver and you insert or remove more than retrieval. Since insertion or removal doesn't involve resizing its much faster than ArrayList.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS