ArrayListIterator next Quiz
Take out a piece of paper and put your name on the upper right corner.
Write a Generic Java class ArrayList<E> that has one method:
public class ArrayList<E> implements List<E> {
private E[] data;
private int size;
...
private class ArrayListIterator<E> implements Iterator<E> {
private int nextIndex;
...
public E next() { // May throw a NoSuchElementException
// your code here.
}
}
}
The method must return the next item in the iteration.
Be sure to write JavaDoc comments for your code.
Conduct a quick review of your code, before you turn it in.
After the code, write an explanation the Big-O performance of the next method.
Hand in your code when you are done.
Take a short break and be back in your seats at
Time remaining: