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