@Test(expected=NoSuchElementException.class) public final void testNext() throws Exception { final Task initialTask = new SimpleTask(1); final TaskIterator iter = new TaskIterator(initialTask); assertNotNull("We should have gotten a task here!", iter.next()); iter.next(); }
public Task next() { if (currentIndex < tasks.size()) { ++currentIndex; return tasks.get(currentIndex - 1); } throw new NoSuchElementException("call to next() even though hasNext() is false."); }
TaskIterator implements Iterator<Task> { public Task next() { if (currentIndex < tasks.size()) { ++currentIndex; return tasks.get(currentIndex - 1); } throw new NoSuchElementException("call to next() even though hasNext() is false."); } }
TaskIterator implements Iterator<Task> { public Task next() { if (currentIndex < tasks.size()) { ++currentIndex; return tasks.get(currentIndex - 1); } throw new NoSuchElementException("call to next() even though hasNext() is false."); } TaskIterator(int expectedNumTasks, final Task... initialTasks);  TaskIterator(final Task... initialTasks); }
TaskIterator implements Iterator<Task> { public Task next() { if (currentIndex < tasks.size()) { ++currentIndex; return tasks.get(currentIndex - 1); } throw new NoSuchElementException("call to next() even though hasNext() is false."); } TaskIterator(int expectedNumTasks, final Task... initialTasks);  TaskIterator(final Task... initialTasks); void insertTasksAfter(final Task referenceTask, final Task... newTasks); void insertTasksAfter(final Task referenceTask, final TaskIterator newTasks); boolean hasNext(); Task next(); void remove(); int getNumTasks(); void append(Task task); void append(TaskIterator taskIterator); }
TaskIterator implements Iterator<Task> { public Task next() { if (currentIndex < tasks.size()) { ++currentIndex; return tasks.get(currentIndex - 1); } throw new NoSuchElementException("call to next() even though hasNext() is false."); } TaskIterator(int expectedNumTasks, final Task... initialTasks);  TaskIterator(final Task... initialTasks); void insertTasksAfter(final Task referenceTask, final Task... newTasks); void insertTasksAfter(final Task referenceTask, final TaskIterator newTasks); boolean hasNext(); Task next(); void remove(); int getNumTasks(); void append(Task task); void append(TaskIterator taskIterator);  }