多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
```java package ds.util; import java.util.Iterator; import java.util.NoSuchElementException; public class ArrayIterator<T> implements Iterator<T> { private int i; private final int size; private final T[] array; public ArrayIterator(T[] array, int size) { this.array = array; this.size = size; } @Override public boolean hasNext() { return i < size; } @Override public T next() { if (!hasNext()) { throw new NoSuchElementException(); } return array[i++]; } } ```