-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestStackQueue.java
More file actions
35 lines (30 loc) · 1.09 KB
/
Copy pathTestStackQueue.java
File metadata and controls
35 lines (30 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Created by cdxu0 on 2017/7/6.
*/
public class TestStackQueue {
public static void main(String[] args) {
GenericStack<String> stack = new GenericStack<>();
stack.push("Tom");
System.out.println("(1) " + stack);
stack.push("Susan");
System.out.println("(2) " + stack);
stack.push("Kim");
stack.push("Michael");
System.out.println("(3) " + stack);
System.out.println("(4) " + stack.pop());
System.out.println("(5) " + stack.pop());
System.out.println("(6) " +stack);
System.out.println("\n\n\n");
GenericQueue<String> queue = new GenericQueue<>();
queue.enqueue("Tom");
System.out.println("(1) " + queue);
queue.enqueue("Susan");
System.out.println("(2) " + queue);
queue.enqueue("Kim");
queue.enqueue("Michael");
System.out.println("(3) " + queue);
System.out.println("(4) " + queue.dequeue());
System.out.println("(5) " + queue.dequeue());
System.out.println("(6) " + queue);
}
}