| 128 | } |
| 129 | |
| 130 | public Iterator<LinkedList.Node<T>> iterator() { |
| 131 | Iterator<LinkedList.Node<T>> iterator = new Iterator<LinkedList.Node<T>>() { |
| 132 | LinkedList.Node<T> node = LinkedList.this.getFirst(); |
| 133 | |
| 134 | public boolean hasNext() { |
| 135 | return this.node != null; |
| 136 | } |
| 137 | |
| 138 | public LinkedList.Node<T> next() { |
| 139 | LinkedList.Node<T> node = this.node; |
| 140 | |
| 141 | if (this.node != null) { |
| 142 | this.node = this.node.next; |
| 143 | } |
| 144 | |
| 145 | return node; |
| 146 | } |
| 147 | |
| 148 | public void remove() { |
| 149 | throw new UnsupportedOperationException("remove"); |
| 150 | } |
| 151 | }; |
| 152 | return iterator; |
| 153 | } |
| 154 | |
| 155 | public LinkedList.Node<T> getFirst() { |
| 156 | return this.first; |