MCPcopy
hub / github.com/careercup/ctci / shiftStacks

Method shiftStacks

java/Chapter 3/Question3_5/MyQueue.java:25–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23 * do operations on stackOldest.
24 */
25 private void shiftStacks() {
26 if (stackOldest.isEmpty()) {
27 while (!stackNewest.isEmpty()) {
28 stackOldest.push(stackNewest.pop());
29 }
30 }
31 }
32
33 public T peek() {
34 shiftStacks();

Callers 2

peekMethod · 0.95
removeMethod · 0.95

Calls 3

isEmptyMethod · 0.45
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected