Skip to content

Commit

Permalink
Update linked_list.md (krahets#1521)
Browse files Browse the repository at this point in the history
双向链表的Dart代码可能存在语法错误,因为前驱节点和后继节点可能为空,所以需要添加问号,否则无法通过空安全检查
  • Loading branch information
ZhongGuanbin authored Sep 28, 2024
1 parent 40d13cb commit dedb4aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/chapter_array_and_linkedlist/linked_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,8 +635,8 @@
/* 双向链表节点类 */
class ListNode {
int val; // 节点值
ListNode next; // 指向后继节点的引用
ListNode prev; // 指向前驱节点的引用
ListNode? next; // 指向后继节点的引用
ListNode? prev; // 指向前驱节点的引用
ListNode(this.val, [this.next, this.prev]); // 构造函数
}
```
Expand Down

0 comments on commit dedb4aa

Please sign in to comment.