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

Method enqueue

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

Adds the item to this queue. @param item the item to add

(Item item)

Source from the content-addressed store, hash-verified

94 * @param item the item to add
95 */
96 public void enqueue(Item item) {
97 Node<Item> oldlast = last;
98 last = new Node<Item>();
99 last.item = item;
100 last.next = null;
101 if (isEmpty()) first = last;
102 else oldlast.next = last;
103 n++;
104 }
105
106 /**
107 * Removes and returns the item on this queue that was least recently added.

Callers 15

bfsMethod · 0.95
keysMethod · 0.95
mainMethod · 0.95
keysLevelOrderMethod · 0.95
keysMethod · 0.95
hasAugmentingPathMethod · 0.95
edgesMethod · 0.95
DirectedCycleXMethod · 0.95
keysMethod · 0.95
keysWithPrefixMethod · 0.95
bfsMethod · 0.95
hasAugmentingPathMethod · 0.95

Calls 1

isEmptyMethod · 0.95

Tested by

no test coverage detected