1 33 package net.sf.jga.util; 34 35 import java.util.Enumeration ; 36 import java.util.NoSuchElementException ; 37 import java.util.Iterator ; 38 39 46 47 public class EnumerationIterator<T> implements Iterator <T>, Iterable <T> { 48 49 private Enumeration <T> _base; 51 52 57 58 public EnumerationIterator(Enumeration <T> enumeration) 59 { 60 if (enumeration == null) 61 throw new IllegalArgumentException (); 62 63 _base = enumeration; 64 } 65 66 70 public Iterator <T> iterator() { return this; } 71 72 76 80 81 public boolean hasNext(){ 82 return _base.hasMoreElements(); 83 } 84 85 90 91 public T next() { 92 return _base.nextElement(); 93 } 94 95 100 101 public void remove() throws UnsupportedOperationException { 102 throw new UnsupportedOperationException (); 103 } 104 } 105 | Popular Tags |