1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.util;
18
19 import java.util.ArrayList;
20 import java.util.Enumeration;
21 import java.util.Iterator;
22 import java.util.List;
23
24
25
26
27
28
29
30 public class SimpleEnumeration<T> implements Enumeration<T> {
31
32 private List<T> internalList = new ArrayList<T>();
33 private Iterator<T> iterator;
34
35 public SimpleEnumeration(T object) {
36 if (object != null) {
37 internalList.add(object);
38 }
39 iterator = internalList.iterator();
40 }
41
42 public SimpleEnumeration(Enumeration<T> enumeration, T object) {
43 while (enumeration.hasMoreElements()) {
44 internalList.add(enumeration.nextElement());
45 }
46 internalList.add(object);
47 iterator = internalList.iterator();
48 }
49
50 public SimpleEnumeration(Enumeration<T> enumeration1, Enumeration<T> enumeration2) {
51 while (enumeration1.hasMoreElements()) {
52 internalList.add(enumeration1.nextElement());
53 }
54 while (enumeration2.hasMoreElements()) {
55 internalList.add(enumeration2.nextElement());
56 }
57 iterator = internalList.iterator();
58 }
59
60 public boolean hasMoreElements() {
61 return iterator.hasNext();
62 }
63
64 public T nextElement() {
65 return iterator.next();
66 }
67
68 }