1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jexl.util;
18
19
20 import java.util.Iterator;
21 import java.util.Enumeration;
22
23 /***
24 * An Iterator wrapper for an Enumeration.
25 *
26 * @author <a href="mailto:geirm@optonline.net">Geir Magnusson Jr.</a>
27 * @version $Id: EnumerationIterator.java,v 1.3 2004/02/28 13:45:21 yoavs Exp $
28 */
29 public class EnumerationIterator implements Iterator
30 {
31 /***
32 * The enumeration to iterate.
33 */
34 private Enumeration enum = null;
35
36 /***
37 * Creates a new iteratorwrapper instance for the specified
38 * Enumeration.
39 *
40 * @param enum The Enumeration to wrap.
41 */
42 public EnumerationIterator( Enumeration enum)
43 {
44 this.enum = enum;
45 }
46
47 /***
48 * Move to next element in the array.
49 *
50 * @return The next object in the array.
51 */
52 public Object next()
53 {
54 return enum.nextElement();
55 }
56
57 /***
58 * Check to see if there is another element in the array.
59 *
60 * @return Whether there is another element.
61 */
62 public boolean hasNext()
63 {
64 return enum.hasMoreElements();
65 }
66
67 /***
68 * Unimplemented. No analogy in Enumeration
69 */
70 public void remove()
71 {
72
73 }
74
75 }