public class ArrayIterator implements java.util.Iterator, Iterable { private int current; private A[] items; public ArrayIterator(A[] items) { this.current = 0; this.items = items; } public boolean hasNext() { return (current < items.length); } public A next() { return items[current++]; } public void remove() { throw new UnsupportedOperationException(); } public java.util.Iterator iterator() { return this; } }