Differences between Java ArrayList and rule list
ArrayList implements a dynamic array-based data structure. The ArrayList is based on the linked list data structure. 1. For ArrayList and sort list, the overhead of adding an element at the end of the list is fixed. For ArrayList, an item is mainly added to the internal array, pointing to the added element. Occasionally, the array may be re-allocated. For the sorted list, this overhead is uniform, allocate an internal Entry object. 2. inserting or deleting an element in the middle of the ArrayList means that all the remaining elements in the list will be moved. the overhead of inserting or deleting an element in the middle of the List is fixed. 3. the random list does not support efficient random element access. 4. the space waste of ArrayList is mainly reflected in the reserved capacity space at the end of the list. The space consumption of the list is reflected in that each of its elements consumes a considerable amount of space. You can say that: when the operation adds data to the end of a column of data rather than in the front or middle, and needs to randomly access the elements in the column, using ArrayList will provide better performance; when you add or delete data in front or middle of a column of data and access the elements in the column in sequence, you should use the sort list.