MCPcopy Create free account
hub / github.com/careercup/ctci / peek

Method peek

java/Chapter 3/Question3_1/Question.java:44–49  ·  view source on GitHub ↗
(int stackNum)

Source from the content-addressed store, hash-verified

42 }
43
44 static int peek(int stackNum) {
45 if (isEmpty(stackNum)) {
46 throw new EmptyStackException();
47 }
48 return buffer[absTopOfStack(stackNum)];
49 }
50
51 static boolean isEmpty(int stackNum) {
52 return stackPointer[stackNum] == -1;

Callers 1

mainMethod · 0.95

Calls 2

isEmptyMethod · 0.95
absTopOfStackMethod · 0.95

Tested by

no test coverage detected