Skip to content

Commit 5eea378

Browse files
committed
Add annotations to Queue.
1 parent 260f24b commit 5eea378

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/data-structures/queue/Queue.js

+16
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ export default class Queue {
55
this.linkedList = new LinkedList();
66
}
77

8+
/**
9+
* @return {boolean}
10+
*/
811
isEmpty() {
912
return !this.linkedList.tail;
1013
}
1114

15+
/**
16+
* @return {*}
17+
*/
1218
peek() {
1319
if (!this.linkedList.head) {
1420
return null;
@@ -17,15 +23,25 @@ export default class Queue {
1723
return this.linkedList.head.value;
1824
}
1925

26+
/**
27+
* @param {*} value
28+
*/
2029
enqueue(value) {
2130
this.linkedList.append(value);
2231
}
2332

33+
/**
34+
* @return {*}
35+
*/
2436
dequeue() {
2537
const removedHead = this.linkedList.deleteHead();
2638
return removedHead ? removedHead.value : null;
2739
}
2840

41+
/**
42+
* @param [callback]
43+
* @return {string}
44+
*/
2945
toString(callback) {
3046
return this.linkedList.toString(callback);
3147
}

0 commit comments

Comments
 (0)