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

Method main

src/main/java/edu/princeton/cs/algs4/Stack.java:177–187  ·  view source on GitHub ↗

Unit tests the Stack data type. @param args the command-line arguments

(String[] args)

Source from the content-addressed store, hash-verified

175 * @param args the command-line arguments
176 */
177 public static void main(String[] args) {
178 Stack<String> stack = new Stack<String>();
179 while (!StdIn.isEmpty()) {
180 String item = StdIn.readString();
181 if (!item.equals("-"))
182 stack.push(item);
183 else if (!stack.isEmpty())
184 StdOut.print(stack.pop() + " ");
185 }
186 StdOut.println("(" + stack.size() + " left on stack)");
187 }
188}
189
190

Callers

nothing calls this directly

Calls 9

isEmptyMethod · 0.95
readStringMethod · 0.95
pushMethod · 0.95
isEmptyMethod · 0.95
printMethod · 0.95
popMethod · 0.95
printlnMethod · 0.95
sizeMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected