Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What are the differences between ArrayList and LinkedList?

0
Posted

What are the differences between ArrayList and LinkedList?

0

Location: http://www.jguru.com/faq/view.jsp?EID=106663 Created: Jul 20, 2000 Modified: 2000-07-20 07:45:25.631 Author: John Zukowski (http://www.jguru.com/guru/viewbio.jsp?EID=7) Question originally posed by Raymond Lui (http://www.jguru.com/guru/viewbio.jsp?EID=72476 An ArrayList is a List implementation backed by a Java array, similar to the Vector class. As the number of elements in the collection increases, the internal array grows to fit them. If there are lots of growth periods, performance degrades as the old array needs to be copied into the new array. However, random access is very quick as it uses an array index to access. With a LinkedList, the List implementation is backed by a doubly linked list data structure, allowing easy inserts/deletions anywhere in the structure, but really slow random accesses as the access must start at an end to get to the specific position. Which you use really depends on the type of operations you need to support.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.