Throw NoSuchElementException if next() is called on the Iterator when hasNext()==false
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@729813
13f79535-47bb-0310-9956-
ffa450edef68
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
+import java.util.NoSuchElementException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
}
public E next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
element = elements[index++];
return element;
}