LinkedList source code reading
Brief: a Doubly-linked list implementation, null element permitable, not synchronized, fail-fast operation
1.How does the Node
class define?
field
- item: storing data
- next: next node
- prev: previous node
2.What are the constuctors?
no param: create a empty list contain no node
param with Collection: create a empty list and insert element corresponding to the order returned by the collection’s iterator
3.How does LinkedList
work while do something aboud index?
It will call node
method to judge which side, start or end, is closer to the specified index. Then, it will choose the closer side to start traversal.