Skip to content

Commit

Permalink
Merge pull request Snailclimb#2415 from CoisiniAKAM/main
Browse files Browse the repository at this point in the history
Update linkedlist-source-code.md
  • Loading branch information
Snailclimb authored Jun 27, 2024
2 parents 4994574 + 2b859fd commit 132ef6a
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 132ef6a

Please sign in to comment.