-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainStack.java
More file actions
41 lines (30 loc) · 945 Bytes
/
MainStack.java
File metadata and controls
41 lines (30 loc) · 945 Bytes
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
36
37
38
39
40
41
package myStack;
public class MainStack{
public static void main(String[] args) {
CustomStack<Integer> st = new CustomStack<>();
st.push(10);
st.push(20);
st.push(30);
st.push(40);
st.push(90);
st.push(45);
st.push(43);
System.out.println(st.contains(90));
st.pop();
st.traverse();
System.out.println("Peeked value is :"+st.peek());
st.reverse();
st.traverse();
System.out.println(st.size());
System.out.println("Centered Value is " + st.center());
StackIterator itr = st.iterator();
while (itr.hasNext()) {
Object element = itr.next();
System.out.print(element + " ");
}
System.out.println();
// for (Integer s : st)
// System.out.print(s +" ");
// System.out.println();
}
}