List as long as there are two implementation classes (ArrayList and LinkedList), Arrylist is based on the implementation of the array, LinkedList is based on the implementation of the list, the following is the little brother to LinkedList understanding:
LinkedList: A collection based on linked list implementation
The dual-link list implements {@code list} and {@code Deque} interfaces. Implements all optional list operations, and the license element (including{@code null}).
First, the implementation of the interface analysis:
Deque (double-ended queue): This queue allows queue-up operations to be queued at the head and tail, so it is more complex than the queue in function. is its structure diagram
About the two-way queue with detailed narration: http://blog.sina.com.cn/s/blog_7768d2210101ajj6.html
Data:
Nodal node data structure:
This includes elements including the next element next and the previous element prev and the data of the element itself item (the data structure of the visible element is the same as the C, thus explaining the role of C + + on the Java floor)
data structure of the queue:
Visible LinkedList data structure is simple enough, a head node, tail nodes, the number of elements. (sufficient to illustrate the application of the bidirectional queue in LinkedList).
Method:
Construction Method : Non-parametric construction, set construction
To add a Delete method:
Add Method:AddFirst, AddLast, add (e E), add (index,e), where
AddFirst is a table header that inserts elements into a doubly linked list
AddLast is a footer that inserts elements into a doubly linked list
Add (e) is also the default insertion of a double-linked list footer
Add (index,e) is the position at which the element is indexed to index
Delete method : Removefirst,removelast, remove (e), remove (index)
Removefirst Delete First element
Removelast Delete last Element
Remove (e) Delete an element with a value of E
Remove (index) deletes an element that is indexed as index
Modification Method:
Set (int index, E Element) modifies the value of an element indexed to index
How the data is actually manipulated:
It is visible that a common method is used to linked the prefix, whereby the data method of the operation queue begins with link.
Tool methods:
Internal iterative methods: like ArrayList, LinkedList also iterates over the output of an element with an implementation of an inner class (you can see that iteration is an idea in Java)
Summarize:
LinkedList is a Java implementation of a doubly linked list, which defines the double-ended operation of the linked list. This collection of linked lists has a good advantage: it enables the quick addition and deletion of elements. But there is also a big drawback: if you get an element at a specified position, it is very inefficient to traverse it in such a way. Therefore, when the collection is selected, it is also considered that the collection is mainly used for viewing and modifying elements or adding or deleting elements.
Data structure and algorithm parsing for JDK encapsulation in Java (Collection Class)----List of lists of LinkedList