Use built-in ArrayIterator class