1 package jp.liq.container.util; 2 3 import java.util.Iterator; 4 5 public class ArrayIterator<T> implements Iterator<T> { 6 private int index; 7 private T[] array; 8 9 public ArrayIterator(T[] array) { 10 this.array = array; 11 } 12 13 public boolean hasNext() { 14 return index < array.length; 15 } 16 17 public T next() { 18 return array[index++]; 19 } 20 21 public void remove() { 22 throw new UnsupportedOperationException(); 23 } 24 25 }