Skip to content

Commit 85c0269

Browse files
authored
format code
1 parent bc7098f commit 85c0269

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

ch05/04_Legacy_Library_with_Generic_Client.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,23 @@ interface Stack<E> {
7878
m/ArrayStack.java:
7979
@SuppressWarnings("unchecked")
8080
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
8591
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+
}
9098
}
9199
92100
m/Stacks.java:

0 commit comments

Comments
 (0)