001package headfirst.adapter.iterenum; 002 003import java.util.Arrays; 004import java.util.Enumeration; 005import java.util.Iterator; 006import java.util.Vector; 007 008@SuppressWarnings("rawtypes") 009public class EI { 010 public static void main (String args[]) { 011 Vector<String> v = new Vector<String>(Arrays.asList(args)); 012 Enumeration enumeration = v.elements(); 013 while (enumeration.hasMoreElements()) { 014 System.out.println(enumeration.nextElement()); 015 } 016 Iterator iterator = v.iterator(); 017 while (iterator.hasNext()) { 018 System.out.println(iterator.next()); 019 } 020 } 021}