(int index, boolean removeTop)
| 42 | } |
| 43 | |
| 44 | public int leftShift(int index, boolean removeTop) { |
| 45 | Stack stack = stacks.get(index); |
| 46 | int removed_item; |
| 47 | if (removeTop) removed_item = stack.pop(); |
| 48 | else removed_item = stack.removeBottom(); |
| 49 | if (stack.isEmpty()) { |
| 50 | stacks.remove(index); |
| 51 | } else if (stacks.size() > index + 1) { |
| 52 | int v = leftShift(index + 1, false); |
| 53 | stack.push(v); |
| 54 | } |
| 55 | return removed_item; |
| 56 | } |
| 57 | |
| 58 | public boolean isEmpty() { |
| 59 | Stack last = getLastStack(); |