// Modified or written by Ex Machina SAGL for inclusion with lambdaj.
// Copyright (c) 2009 Mario Fusco.
// Licensed under the Apache License, Version 2.0 (the "License")

package ch.lambdaj.util.iterator;

/**
 * @author Mario Fusco
 */
public class ResettableIteratorOnArray<T> extends ResettableIterator<T> {

    private final T[] array;
    private int counter = 0;

    public ResettableIteratorOnArray(T[] array) {
        this.array = array;
    }

    public boolean hasNext() {
        return counter < array.length;
    }

    public T next() {
        return array[counter++];
    }

    public void reset() {
        counter = 0;
    }
}
@@ -206,16 +206,39 @@
 tor;%0D%0A%0D%0A
+import java.util.*;%0D%0A%0D%0A
 /**%0D%0A * 
@@ -587,32 +587,93 @@
 lic T next() %7B%0D%0A
+        if (!hasNext()) throw new NoSuchElementException();%0D%0A
         return a

throw NoSuchElementException while try to access an unexistent item