(int capacity)
| 36 | } |
| 37 | |
| 38 | private void resize(int capacity) { |
| 39 | Item[] copy = (Item[]) new Object[capacity]; |
| 40 | for (int i = 0; i < n; i++) |
| 41 | copy[i] = v[(first + i) % v.length]; |
| 42 | v = copy; |
| 43 | first = 0; |
| 44 | last = n; |
| 45 | } |
| 46 | |
| 47 | // add the item |
| 48 | public void enqueue(Item item) { |