001package headfirst.adapter.iterenum; 002 003import java.util.Enumeration; 004import java.util.Iterator; 005 006@SuppressWarnings("rawtypes") 007public class EnumerationIterator implements Iterator { 008 Enumeration enumeration; 009 010 public EnumerationIterator(Enumeration enumeration) { 011 this.enumeration = enumeration; 012 } 013 014 public boolean hasNext() { 015 return enumeration.hasMoreElements(); 016 } 017 018 public Object next() { 019 return enumeration.nextElement(); 020 } 021 022 public void remove() { 023 throw new UnsupportedOperationException(); 024 } 025}