Practice: ArrayList Iterators

Take out a piece of paper. We’ll be programming on paper.

Problem 1

public interface Iterator211<E> {
  /** @return true if the iteration has more elements. */
  boolean hasNext();
  /** @return The next element in the iteration. */
  E next();
}

public class ArrayList<E> implements List211<E> {
  /** Holds the items in the list. */
  private E[] data;
  /** The size of the list. */
  private int size;
  
  private class ArrayListIterator<E> implements Iterator<E> {

    // your code goes here.

  }
}

Problem 2

Show me your code before you leave