From 8e8f28ffcf475ff869ec47d05f8753d8fac7117a Mon Sep 17 00:00:00 2001 From: H2rmone <3357458@qq.com> Date: Fri, 28 Jan 2022 03:36:39 +0800 Subject: [PATCH] Use exist method to be consistent with Stack (#708) --- 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 f6ec6d2d..64e646fc 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; }