THIS DATA IS TAKEN FROM JAVA DOC>
THIS add() FUNCTIONALITY WHEN USED WITH ARRAYLIST
public boolean add(E e)
Appends the specified element to the end of this list.
Specified by:
add in interface Collection
Specified by:
add in interface List
Overrides:
add in class AbstractList
THIS add() FUNCTIONALITY WHEN USED WITH LINKEDLIST
public boolean add(E e)
Appends the specified element to the end of this list.
This method is equivalent to addLast(E).
Specified by:
add in interface Collection
Specified by:
add in interface Deque
Specified by:
add in interface List
Specified by:
add in interface Queue
IN BOTH CASES YOU CAN SEE add() WORKING DIFFERENTLY.
IN ARRAYLIST IT USES ONLY LIST AND COLLECTION INTERFACE.
BUT IN LINKEDLIST CASE IT USING DEQUE AND QUEUE INTERFACE means internally java is actually creating a node and the inserting it non-contiguously .
Hope you get your answer.