File tree 1 file changed +16
-8
lines changed
1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -78,15 +78,23 @@ interface Stack<E> {
78
78
m/ArrayStack.java:
79
79
@SuppressWarnings("unchecked")
80
80
class ArrayStack<E> implements Stack<E> {
81
- private List list;
82
- public ArrayStack() { list = new ArrayList(); }
83
- public boolean empty() { return list.size() == 0; }
84
- public void push(E elt) { list.add(elt); } // unchecked call
81
+ private List list;
82
+ public ArrayStack() {
83
+ list = new ArrayList();
84
+ }
85
+ public boolean empty() {
86
+ return list.size() == 0;
87
+ }
88
+ public void push(E elt) {
89
+ list.add(elt);
90
+ } // unchecked call
85
91
public E pop() {
86
- Object elt = list.remove(list.size()-1);
87
- return (E)elt; // unchecked cast
88
- }
89
- public String toString() { return "stack"+list.toString(); }
92
+ Object elt = list.remove(list.size()-1);
93
+ return (E)elt; // unchecked cast
94
+ }
95
+ public String toString() {
96
+ return "stack"+list.toString();
97
+ }
90
98
}
91
99
92
100
m/Stacks.java:
You can’t perform that action at this time.
0 commit comments