1 18 19 package org.apache.struts.util; 20 21 import java.util.Enumeration ; 22 import java.util.Iterator ; 23 import java.util.NoSuchElementException ; 24 25 26 34 35 public class IteratorAdapter implements Iterator { 36 private Enumeration e; 37 38 public IteratorAdapter(Enumeration e) { 39 this.e = e; 40 } 41 42 public boolean hasNext() { 43 return e.hasMoreElements(); 44 } 45 46 public Object next() { 47 if (!e.hasMoreElements()) { 48 throw new NoSuchElementException ("IteratorAdaptor.next() has no more elements"); 49 } 50 return e.nextElement(); 51 } 52 public void remove() { 53 throw new UnsupportedOperationException ("Method IteratorAdaptor.remove() not implemented"); 54 } 55 } 56 | Popular Tags |