/Users/lyon/j4p/src/classUtils/pack/util/ListEnumeration.java

1    package classUtils.pack.util; 
2     
3    import java.util.Enumeration; 
4    import java.util.Iterator; 
5    import java.util.List; 
6     
7    /** 
8     * An Enumeration for a <tt>java.util.List</tt> object. 
9     *  
10    * @author Cristiano Sadun 
11    */ 
12   public class ListEnumeration implements Enumeration { 
13        
14       private Iterator iterator; 
15        
16       public ListEnumeration(List list) { 
17           this.iterator=list.iterator(); 
18       } 
19    
20       /** 
21        * @see java.util.Enumeration#hasMoreElements() 
22        */ 
23       public boolean hasMoreElements() { 
24           return iterator.hasNext(); 
25       } 
26    
27       /** 
28        * @see java.util.Enumeration#nextElement() 
29        */ 
30       public Object nextElement() { 
31           return iterator.next(); 
32       } 
33    
34   } 
35