From 7f525f825a6b7f276e03b7cb20d6948994d71b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=83=E8=89=AF?= Date: Mon, 17 May 2021 13:55:43 +0800 Subject: [PATCH] Use exist method to be consistent with Stack --- src/data-structures/queue/Queue.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data-structures/queue/Queue.js b/src/data-structures/queue/Queue.js index f6ec6d2dad..64e646fc00 100644 --- a/src/data-structures/queue/Queue.js +++ b/src/data-structures/queue/Queue.js @@ -21,7 +21,7 @@ export default class Queue { * @return {*} */ peek() { - if (!this.linkedList.head) { + if (this.isEmpty()) { return null; }