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

Method push

java/Chapter 3/Question3_3/SetOfStacks.java:20–29  ·  view source on GitHub ↗
(int v)

Source from the content-addressed store, hash-verified

18 }
19
20 public void push(int v) {
21 Stack last = getLastStack();
22 if (last != null && !last.isFull()) { // add to last
23 last.push(v);
24 } else { // must create new stack
25 Stack stack = new Stack(capacity);
26 stack.push(v);
27 stacks.add(stack);
28 }
29 }
30
31 public int pop() {
32 Stack last = getLastStack();

Callers 1

mainMethod · 0.95

Calls 4

getLastStackMethod · 0.95
isFullMethod · 0.95
pushMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected