Commit | Line | Data |
---|---|---|
f5d81de2 JB |
1 | |
2 | class Main { | |
3 | ||
4 | /** | |
5 | * The main() function | |
6 | * @param String[] args main() function arguments array | |
7 | */ | |
8 | public static void main(String[] args) { | |
9 | Pile<Integer> stack = new Pile<Integer>(5); | |
10 | ||
11 | stack.empiler(3); | |
12 | stack.empiler(5); | |
13 | stack.empiler(4); | |
14 | stack.empiler(7); | |
15 | stack.empiler(8); | |
16 | ||
17 | stack.afficher(); | |
18 | ||
19 | System.out.println("Stack index " + stack.getHeadIndex()); | |
20 | System.out.println("Stack head value " + stack.depiler()); | |
21 | System.out.println("Stack index " + stack.getHeadIndex()); | |
22 | System.out.println("Stack head value " + stack.depiler()); | |
23 | System.out.println("Stack index " + stack.getHeadIndex()); | |
24 | System.out.println("Stack head value " + stack.depiler()); | |
25 | System.out.println("Stack index " + stack.getHeadIndex()); | |
26 | System.out.println("Stack head value " + stack.depiler()); | |
27 | System.out.println("Stack index " + stack.getHeadIndex()); | |
28 | System.out.println("Stack head value " + stack.depiler()); | |
29 | System.out.println("Stack index " + stack.getHeadIndex()); | |
30 | System.out.println("Stack head value " + stack.depiler()); | |
31 | System.out.println("Stack index " + stack.getHeadIndex()); | |
32 | ||
33 | stack.afficher(); | |
34 | ||
35 | Pile<String> stackStr = new Pile<String>(5); | |
36 | ||
37 | stackStr.empiler("Bonjour"); | |
38 | stackStr.empiler("Salut"); | |
39 | stackStr.empiler("Hello"); | |
40 | stackStr.empiler("Hi"); | |
41 | stackStr.empiler("Hugh"); | |
42 | ||
43 | stackStr.afficher(); | |
44 | ||
45 | System.out.println("Stack index " + stackStr.getHeadIndex()); | |
46 | System.out.println("Stack head value " + stackStr.depiler()); | |
47 | System.out.println("Stack index " + stackStr.getHeadIndex()); | |
48 | System.out.println("Stack head value " + stackStr.depiler()); | |
49 | System.out.println("Stack index " + stackStr.getHeadIndex()); | |
50 | System.out.println("Stack head value " + stackStr.depiler()); | |
51 | System.out.println("Stack index " + stackStr.getHeadIndex()); | |
52 | System.out.println("Stack head value " + stackStr.depiler()); | |
53 | System.out.println("Stack index " + stackStr.getHeadIndex()); | |
54 | System.out.println("Stack head value " + stackStr.depiler()); | |
55 | System.out.println("Stack index " + stackStr.getHeadIndex()); | |
56 | System.out.println("Stack head value " + stackStr.depiler()); | |
57 | System.out.println("Stack index " + stackStr.getHeadIndex()); | |
58 | ||
59 | stackStr.afficher(); | |
60 | ||
61 | ArrayDeque<String> stackStrDeq = new ArrayDeque<String>(); | |
62 | stackStrDeq.push("Bonjour"); | |
63 | stackStrDeq.push("Salut"); | |
64 | stackStrDeq.push("Hello"); | |
65 | stackStrDeq.push("Hi"); | |
66 | stackStrDeq.push("Hugh"); | |
67 | ||
68 | System.out.println("Stack index " + stackStrDeq.size()); | |
69 | System.out.println("Stack head value " + stackStrDeq.pop()); | |
70 | System.out.println("Stack index " + stackStrDeq.size()); | |
71 | System.out.println("Stack head value " + stackStrDeq.pop()); | |
72 | System.out.println("Stack index " + stackStrDeq.size()); | |
73 | System.out.println("Stack head value " + stackStrDeq.pop()); | |
74 | System.out.println("Stack index " + stackStrDeq.size()); | |
75 | System.out.println("Stack head value " + stackStrDeq.pop()); | |
76 | System.out.println("Stack index " + stackStrDeq.size()); | |
77 | System.out.println("Stack head value " + stackStrDeq.pop()); | |
78 | System.out.println("Stack index " + stackStrDeq.size()); | |
79 | System.out.println("Stack head value " + stackStrDeq.pop()); | |
80 | System.out.println("Stack index " + stackStrDeq.size()); | |
81 | ||
82 | } | |
83 | } |