MCPcopy
hub / github.com/kevin-wayne/algs4 / dequeue

Method dequeue

src/main/java/edu/princeton/cs/algs4/Queue.java:112–119  ·  view source on GitHub ↗

Removes and returns the item on this queue that was least recently added. @return the item on this queue that was least recently added @throws NoSuchElementException if this queue is empty

()

Source from the content-addressed store, hash-verified

110 * @throws NoSuchElementException if this queue is empty
111 */
112 public Item dequeue() {
113 if (isEmpty()) throw new NoSuchElementException("Queue underflow");
114 Item item = first.item;
115 first = first.next;
116 n--;
117 if (isEmpty()) last = null; // to avoid loitering
118 return item;
119 }
120
121 /**
122 * Returns a string representation of this queue.

Callers 14

bfsMethod · 0.95
mainMethod · 0.95
keysLevelOrderMethod · 0.95
hasAugmentingPathMethod · 0.95
DirectedCycleXMethod · 0.95
bfsMethod · 0.95
hasAugmentingPathMethod · 0.95
TopologicalXMethod · 0.95
levelOrderMethod · 0.95
hasAugmentingPathMethod · 0.95
bfsMethod · 0.95
EulerianPathMethod · 0.45

Calls 1

isEmptyMethod · 0.95

Tested by

no test coverage detected