forked fromjsquared21/Intro-to-Java-Programming
- Notifications
You must be signed in to change notification settings - Fork0
Commit6245273
authored
fix GenericStack.pop() and modify toString()
1. Call list[size] should return null (if list[size-1] is the last element of the stack), this does not happen because the pop() method does not actually eliminate any element.2. When pop() is called, size should never be left with a negative value.1 parent1fcbde2 commit6245273
1 file changed
+17
-3
lines changedLines changed: 17 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
22 | 22 |
| |
23 | 23 |
| |
24 | 24 |
| |
25 |
| - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
26 | 31 |
| |
27 | 32 |
| |
28 | 33 |
| |
| |||
41 | 46 |
| |
42 | 47 |
| |
43 | 48 |
| |
44 |
| - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
45 | 59 |
| |
46 |
| - | |
| 60 | + |
0 commit comments
Comments
(0)