Article From:https://www.cnblogs.com/lianghaode/p/9124877.html

arraylist The sequential table is implemented in an array. Think of the array to query that element only give its subscript, so that ArrayList random access to many scenarios is more appropriate. But if you delete an element, such as the first I element, you need to move the element after I forward to ensure that it is smooth.The correctness of the order table is also the same as increasing the number of elements to move. It is inefficient to delete additional words on many occasions.

And LinkedList is a two-way chain table, and the attention is the list. To query, only the header node can start querying step by step. There is no convenience to query the subscript directly, and it needs to be traversed. However, if you want to increase and delete an element, you need to change the direction of its front and rear elements, instead of a.Rraylist mobile as a whole, so it is said that more occasions for more additions and deletions.

Thanks to the advice and help of the friends, since the LinkedList query can only begin to query gradually from the beginning of the node, you can use the iterator way without starting access every time from the head node, because it caches the front and back nodes of the current node. Measured query efficiency and ArraThere is no big difference in yList.

Similar Posts:

Link of this Article: ArraryList and linkedList

Leave a Reply

Your email address will not be published. Required fields are marked *