1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.morph.util;
17
18 import java.util.Enumeration;
19 import java.util.Iterator;
20
21 /**
22 * Exposes an Enumeration as an Iterator.
23 *
24 * @author Matt Sgarlata
25 * @since Dec 5, 2004
26 */
27 public class EnumerationIterator implements Iterator {
28
29 private Enumeration enumeration;
30
31 public EnumerationIterator(Enumeration enumeration) {
32 this.enumeration = enumeration;
33 }
34
35 public boolean hasNext() {
36 return enumeration.hasMoreElements();
37 }
38
39 public Object next() {
40 return enumeration.nextElement();
41 }
42
43 public void remove() {
44 throw new UnsupportedOperationException();
45 }
46
47 }