Question: Java arraylist, linkedlist
Here is the answer.
The ArrayList is actually encapsulating an actualy Array, an Object. When you instanciate ArrayList, an array is created, and when you add values into it, the array changes its size accordingly.
The ArrayList class offers quick access to individual elements of the list. This quick access comes at a cost of slower operations for adding and removing in the middle of the list. If this latter behavior is what you desire, than the LinkedList class offers a better alternative. It provides quick sequential access, additions, and deletes, at a cost of slower random access.
The LinkedList is implemented using nodes linked to each other. Each node contains a previous node link, next node link, and value, which contains the actual data. When new data is inserted, a node is inserted and the links of the surrounding nodes are updated accordingly. When one is removed, 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.the same happens ‚?? The surrounding nodes are changing their links and the deleted node is garbage collected.