Amazon interview question

Why would you choose an ArrayList() over a LinkedList()

Interview Answer

Anonymous

10 Jun 2011

ArrayList if you need to grab nth element (random access). With linked list, you need to iterate through. LinkedList if you will be inserting elements between other elements. With arrayList, adding elements inbetween forces a "copy" of the array to be made.