Double-linked list
双向链表数据结构中需要维护两个关键变量:first,last,所以在链表中进行操作时,总是需要进行相对应的判断
节点对象
Add操作
以上使用的实际操作:
Inserts element e before non-null Node succ.在一个非空节点前插入元素
当判断插入元素的位置不是尾节点的时候调用该方法
在头节点插入元素在尾节点插入元素
添加指定集合中的所有元素到链表
Remove操作
以上使用的实际操作
删除非空节点(unlink操作)
删除非空头节点
删除非空尾节点
实现的队列操作也是调用以上的link和unlink方法进行
list迭代器
Returns a list-iterator of the elements in this list (in proper sequence), starting at the specified position in the list. Obeys the general contract of List.listIterator(int).The list-iterator is fail-fast: if the list is structurally modified at any time after the Iterator is created, in any way except through the list-iterator’s own remove or add methods, the list-iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.
返回一个在指定索引位置开始迭代的list迭代器,支持快速失败操作
以下均使用链表的遍历操作
用于对迭代器中各个元素执行给定的操作,比如对节点中元素都进行加1操作等