MCPcopy
hub / github.com/yangshun/lago / dequeue

Method dequeue

src/data-structures/Queue.ts:39–51  ·  view source on GitHub ↗

* Removes the element at the front of the Queue. * @return {*} The element at the front of the Queue.

()

Source from the content-addressed store, hash-verified

37 * @return {*} The element at the front of the Queue.
38 */
39 dequeue(): T | undefined {
40 if (this.isEmpty()) {
41 return undefined;
42 }
43
44 const node = this._dummyHead.next as Node<T>;
45 const newFirst = node.next as Node<T> | DummyTailNode;
46 this._dummyHead.next = newFirst;
47 newFirst.prev = this._dummyHead;
48 node.next = null;
49 this._length--;
50 return node.value;
51 }
52
53 /**
54 * Returns true if the Queue has no elements.

Callers 5

breadthFirstSearchFunction · 0.95
topologicalSortFunction · 0.95
Deque.test.tsFile · 0.45
Queue.test.tsFile · 0.45

Calls 1

isEmptyMethod · 0.95

Tested by

no test coverage detected