Java Reference
In-Depth Information
157 }
158
159 /**
160
Sets the last traversed element to a different
161
value.
162 @param element
the element to set
163 */
164
public void
set(Object 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 }
680
681
ch15/impllist/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
8 {
9 /**
10
Moves the iterator past the next element.
11 @return
the traversed element
12 */
13 Object 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