1 package uk.co.jezuk.mango.iterators; 2 3 10 public class ArrayIterator implements java.util.Iterator  11 { 12 public ArrayIterator(Object [] array) 13 { 14 array_ = array; 15 index_ = 0; 16 } 18 public boolean hasNext() 19 { 20 return (array_ != null) && (index_ != array_.length); 21 } 23 public Object next() 24 { 25 return array_[index_++]; 26 } 28 public void remove() 29 { 30 throw new UnsupportedOperationException ("uk.co.jezuk.mango.ArrayIterator does not support the remove method"); 31 } 33 private Object [] array_; 35 private int index_; 36 } | Popular Tags |