1: // @author Frank M. Carrano, Timothy M. Henry
2: // @version 5.0
3: public T next()
4: {
5: T result;
6: if (hasNext())
7: {
8: result = nextNode.getData();
9: nextNode = nextNode.getNextNode(); // Advance iterator
10: }
11: else
12: throw new NoSuchElementException("Illegal call to next(); " +
13: "iterator is after end of list.");
14: return result; // Return next entry in iteration
15: } // end next