From dedb4aaced15ddfdf1817c1bd047fb03a248903e Mon Sep 17 00:00:00 2001 From: ZhongGuanbin <93035140+ZhongGuanbin@users.noreply.github.com> Date: Sat, 28 Sep 2024 09:13:18 +0800 Subject: [PATCH] Update linked_list.md (#1521) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 双向链表的Dart代码可能存在语法错误,因为前驱节点和后继节点可能为空,所以需要添加问号,否则无法通过空安全检查 --- docs/chapter_array_and_linkedlist/linked_list.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/chapter_array_and_linkedlist/linked_list.md b/docs/chapter_array_and_linkedlist/linked_list.md index 0c97329f5..07750e6a9 100755 --- a/docs/chapter_array_and_linkedlist/linked_list.md +++ b/docs/chapter_array_and_linkedlist/linked_list.md @@ -635,8 +635,8 @@ /* 双向链表节点类 */ class ListNode { int val; // 节点值 - ListNode next; // 指向后继节点的引用 - ListNode prev; // 指向前驱节点的引用 + ListNode? next; // 指向后继节点的引用 + ListNode? prev; // 指向前驱节点的引用 ListNode(this.val, [this.next, this.prev]); // 构造函数 } ```