mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-23 23:56:28 +08:00
Update linked_list.md (#1521)
双向链表的Dart代码可能存在语法错误,因为前驱节点和后继节点可能为空,所以需要添加问号,否则无法通过空安全检查
This commit is contained in:
parent
40d13cb81f
commit
dedb4aaced
1 changed files with 2 additions and 2 deletions
|
@ -635,8 +635,8 @@
|
|||
/* 双向链表节点类 */
|
||||
class ListNode {
|
||||
int val; // 节点值
|
||||
ListNode next; // 指向后继节点的引用
|
||||
ListNode prev; // 指向前驱节点的引用
|
||||
ListNode? next; // 指向后继节点的引用
|
||||
ListNode? prev; // 指向前驱节点的引用
|
||||
ListNode(this.val, [this.next, this.prev]); // 构造函数
|
||||
}
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue