1 // Copyright 2006 all rights reserved; see LICENSE file for BSD-style license
3 package edu.berkeley.sbp.util;
6 public final class ArrayIterator<T> implements Iterator<T>, Iterable<T> {
8 private final T[] array;
13 public ArrayIterator(T[] array) { this(array, 0, array.length); }
14 public ArrayIterator(T[] array, int start, int len) {
21 public void remove() { throw new Error(); }
22 public boolean hasNext() { return i<start+len; }
23 public T next() { return array[i++]; }
24 public Iterator<T> iterator() { return this; }