| 1 | |
package org.webslinger.collections; |
| 2 | |
|
| 3 | |
import java.util.Enumeration; |
| 4 | |
import java.util.Iterator; |
| 5 | |
|
| 6 | |
public class IteratorEnumeration<T> implements Iterator<T> { |
| 7 | |
private final Enumeration<T> enumeration; |
| 8 | |
|
| 9 | 0 | public IteratorEnumeration(Enumeration<T> enumeration) { |
| 10 | 0 | this.enumeration = enumeration; |
| 11 | 0 | } |
| 12 | |
|
| 13 | |
public Enumeration<T> getEnumeration() { |
| 14 | 0 | return enumeration; |
| 15 | |
} |
| 16 | |
|
| 17 | |
public boolean hasNext() { |
| 18 | 0 | return getEnumeration().hasMoreElements(); |
| 19 | |
} |
| 20 | |
|
| 21 | |
public T next() { |
| 22 | 0 | return getEnumeration().nextElement(); |
| 23 | |
} |
| 24 | |
|
| 25 | |
public void remove() { |
| 26 | 0 | throw new UnsupportedOperationException(); |
| 27 | |
} |
| 28 | |
} |