Java Reference
In-Depth Information
161
value.
162 @param element
the element to set
163 */
164
public void
set(E element)
165 {
166
if
(position ==
null
)
167
throw
new NoSuchElementException();
168 position.data = element;
169 }
170
171
private
Node position;
172
private
Node previous;
173 }
174 }
773
774
ch17/genlist/ListIterator.java
1 /**
2
A list iterator allows access to a position
in a linked list.
3
This interface contains a subset of the
methods of the
4
standard java.util.ListIterator interface.
The methods for
5
backward traversal are not included.
6 */
7
public interface
ListIterator<E>
8 {
9 /**
10
Moves the iterator past the next
element.
11 @return
the traversed element
12 */
13 E next();
14
15 /**
16
Tests if there is an element after the
iterator
17
position.
18 @return
true if there is an element
after the iterator
19
position
20 */