1 24 25 package org.objectweb.dream.util; 26 27 import java.util.Iterator ; 28 import java.util.NoSuchElementException ; 29 30 32 public final class ArrayIterator implements Iterator  33 { 34 35 private Object [] array; 36 int index = 0; 37 38 43 public ArrayIterator(Object [] array) 44 { 45 this.array = array; 46 } 47 48 51 public void remove() 52 { 53 throw new UnsupportedOperationException (); 54 } 55 56 59 public boolean hasNext() 60 { 61 return index < array.length; 62 } 63 64 67 public Object next() 68 { 69 if (!hasNext()) 70 { 71 throw new NoSuchElementException (); 72 } 73 return array[index++]; 74 } 75 76 } | Popular Tags |