VectorEnumeration.java
jmud-0.11/src/util/list/VectorEnumeration.java · 526 B
From the archive jmud-0_11.tgz
Download the archive « Back to the archive contents
package util.list;
import java.util.NoSuchElementException;
import java.util.Enumeration;
public class VectorEnumeration implements Enumeration {
private Vector vect = null;
private int cursor = 0;
public VectorEnumeration(Vector v) {
vect = v;
}
public boolean hasMoreElements() {
return cursor < vect.getSize();
}
public Object nextElement() throws NoSuchElementException {
if (!hasMoreElements())
throw new NoSuchElementException();
return vect.getElementAt(cursor++);
}
}