Iterates with an index over a collection.