JDK源码02

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操作等

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值