Make it possible to add objects to LinkedList.

This commit is contained in:
Oleksii Trekhleb
2018-04-09 12:15:28 +03:00
parent cdf72208b3
commit 8c46dbfb6d
10 changed files with 206 additions and 191 deletions

View File

@@ -18,11 +18,15 @@ export default class Queue {
}
enqueue(value) {
this.linkedList.append({ value });
this.linkedList.append(value);
}
dequeue() {
const removedHead = this.linkedList.deleteHead();
return removedHead ? removedHead.value : null;
}
toString(callback) {
return this.linkedList.toString(callback);
}
}