1 18 19 package com.Ostermiller.util; 20 21 import java.util.*; 22 23 32 public class EnumerationIterator <ElementType> implements Iterator { 33 34 37 private Enumeration<ElementType> enumeration; 38 39 46 public EnumerationIterator(Enumeration<ElementType> enumeration){ 47 this.enumeration = enumeration; 48 } 49 50 58 public boolean hasNext(){ 59 return enumeration.hasMoreElements(); 60 } 61 62 71 public ElementType next() throws NoSuchElementException { 72 return enumeration.nextElement(); 73 } 74 75 82 public void remove(){ 83 throw new UnsupportedOperationException ("EnumerationIterator does not support remove()"); 84 } 85 } | Popular Tags |