()
| 41 | } |
| 42 | |
| 43 | public String dequeue() { |
| 44 | if (isEmpty()) |
| 45 | return null; |
| 46 | String item = first.item; |
| 47 | first = first.next; |
| 48 | n--; |
| 49 | if (isEmpty()) |
| 50 | last = null; |
| 51 | return item; |
| 52 | } |
| 53 | |
| 54 | public static void main(String[] args) { |
| 55 | LinkedQueue queue = new LinkedQueue(); |