MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

collections/StackCollision.java:7–20  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

5
6public class StackCollision {
7 public static void main(String[] args) {
8 onjava.Stack<String> stack = new onjava.Stack<>();
9 for(String s : "My dog has fleas".split(" "))
10 stack.push(s);
11 while(!stack.isEmpty())
12 System.out.print(stack.pop() + " ");
13 System.out.println();
14 java.util.Stack<String> stack2 =
15 new java.util.Stack<>();
16 for(String s : "My dog has fleas".split(" "))
17 stack2.push(s);
18 while(!stack2.empty())
19 System.out.print(stack2.pop() + " ");
20 }
21}
22/* Output:
23fleas has dog My

Callers

nothing calls this directly

Calls 6

pushMethod · 0.95
isEmptyMethod · 0.95
popMethod · 0.95
splitMethod · 0.80
printMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected