Question d’entretien chez Amazon

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

Réponse à la question d'entretien

Utilisateur anonyme

10 juin 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.