01: package com.jamonapi.utils;
02:
03: /** Simple Wrapper utility class that makes an Enumeration behave like an Iterator. **/
04:
05: import java.util.*;
06:
07: public class EnumIterator extends java.lang.Object implements
08: java.util.Iterator {
09:
10: Enumeration enumer;
11:
12: public EnumIterator(Enumeration enumer) {
13:
14: this .enumer = enumer;
15:
16: }
17:
18: public boolean hasNext() {
19:
20: return enumer.hasMoreElements();
21:
22: }
23:
24: public Object next() {
25:
26: return enumer.nextElement();
27:
28: }
29:
30: public void remove() {
31:
32: throw new UnsupportedOperationException();
33:
34: }
35:
36: }
|