Take out a piece of paper. We’ll be programming on paper.
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. } }
Answer the following questions:
What is the Big-O of the next method?
How do we keep track of of the itteration?