Use exist method to be consistent with Stack (#708)

This commit is contained in:
H2rmone 2022-01-28 03:36:39 +08:00 committed by GitHub
parent d227646201
commit 8e8f28ffcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ export default class Queue {
* @return {*}
*/
peek() {
if (!this.linkedList.head) {
if (this.isEmpty()) {
return null;
}