First of all, ArrayList and LinkedList are common container classes in Java, all implement the list interface, but because the data structure is different when implementing the list interface, there are differences in their usage.
Here's a summary:
1. ArrayList is an array-based linear table, except that it can be dynamically extended. If you do not specify a ArrayList initial capacity value, it takes the default value of 10, and if you add an object reference to the ArrayList, it will automatically expand when it is not already accommodated, and the coefficient of expansion is 1.5;
2. ArrayList is very fast for searching by index value, and the time Complexity is O (1); However, for the insertion and deletion of redundant mobile copies of the consumption of processing, the time complexity of O (n);
3. LinkedList is a list interface based on the data structure of the doubly linked list, so the execution efficiency of the lookup is low and the time complexity is O (n).
4. LinkedList for insertion and deletion, the execution efficiency is high, the time complexity is O (1);
5. From the storage point of view, LinkedList than ArrayList memory consumption is higher, because each node needs to have an extra two nodes of the reference to represent;
Note: Limited capacity, if there are errors, please advise!
[Java Basics] The difference between ArrayList and LinkedList and the usage scene