💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
```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++]; } } ```