Skip to content

Commit

Permalink
Update linkedlist-source-code.md
Browse files Browse the repository at this point in the history
修改了“在指定元素之前插入元素”代码注释,原有注释对链表状态描述有误
  • Loading branch information
CoisiniAKAM authored Jun 25, 2024
1 parent a955c64 commit 2b859fd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/java/collection/linkedlist-source-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ void linkBefore(E e, Node<E> succ) {
final Node<E> newNode = new Node<>(pred, e, succ);
// 将 succ 节点前驱引用 prev 指向新节点
succ.prev = newNode;
// 判断尾节点是否为空,为空表示当前链表还没有节点
// 判断前驱节点是否为空,为空表示 succ 是第一个节点
if (pred == null)
// 新节点成为第一个节点
first = newNode;
else
// succ 节点前驱的后继引用指向新节点
Expand Down

0 comments on commit 2b859fd

Please sign in to comment.