1	package antlr.collections.impl;
2	
3	import java.util.Enumeration;
4	import java.util.NoSuchElementException;
5	import antlr.collections.Enumerator;
6	
7	// based on java.lang.Vector; returns any null indices between non-null ones.
8	class VectorEnumeration implements Enumeration {
9		Vector vector;
10		int i;
11	
12	
13		VectorEnumeration(Vector v) {
14			vector = v;
15			i = 0;
16		}
17		public boolean hasMoreElements() {
18			synchronized (vector) {
19				return i <= vector.lastElement;
20			}
21		}
22		public Object nextElement() {
23			synchronized (vector) {
24				if (i <= vector.lastElement) {
25					return vector.data[i++];
26				}
27				throw new NoSuchElementException("VectorEnumerator");
28			}
29		}
30	}
31