1: // @author Frank M. Carrano, Timothy M. Henry 2: // @version 5.0 3: public T next() 4: { 5: checkIntegrity(); 6: if (hasNext()) 7: { 8: wasNextCalled = true; 9: T nextEntry = list[nextIndex]; 10: nextIndex++; // Advance iterator 11: return nextEntry; 12: } 13: else 14: throw new NoSuchElementException("Illegal call to next(); " + 15: "iterator is after end of list."); 16: } // end next