(Item item)
| 46 | |
| 47 | // add the item |
| 48 | public void enqueue(Item item) { |
| 49 | if (item == null) throw new IllegalArgumentException(); |
| 50 | if (n == v.length) resize(2 * v.length); |
| 51 | v[last++] = item; |
| 52 | if (last == v.length) last = 0; |
| 53 | n++; |
| 54 | } |
| 55 | |
| 56 | // remove and return a random item |
| 57 | public Item dequeue() { |