LinkedList are stored with dynamic lists, while ArrayList are stored in dynamic arrays.
First, if the array to query, set up, and so on, with ArrayList faster, the method is get () and set ().
Second, if the data to increase, move and other operations, with LinkedList relatively fast, the method has a large () and remove ().
There is a private class in LinkedList, as follows:
Private static class Entry {
Object element; Element value
Entry Next; Next pointer address
Entry previous; Previous pointer address
}
When you add or remove elements, entry next of the last pointer refers to the new position, and the pointer to the newly added element entry previous to the last element. However, there is a certain amount of waste to memory because the front and back pointers are always stored.
For ArrayList, the movement of data is involved, especially if the first element is added or deleted, then all the remaining arrays move. The increase is likely to result in the expansion of the array, each expansion of about 50%, the formula for the new total capacity = (/2+1 old capacity).
Third, LinkedList does not support efficient random element access.
The difference between LinkedList and arrarylist. <java>