Adds the item to this queue. @param item the item to add
(Item item)
| 94 | * @param item the item to add |
| 95 | */ |
| 96 | public void enqueue(Item item) { |
| 97 | Node<Item> oldlast = last; |
| 98 | last = new Node<Item>(); |
| 99 | last.item = item; |
| 100 | last.next = null; |
| 101 | if (isEmpty()) first = last; |
| 102 | else oldlast.next = last; |
| 103 | n++; |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * Removes and returns the item on this queue that was least recently added. |
no test coverage detected