NiceVectorEnumeration.java

jmud-0.11/src/util/nice/NiceVectorEnumeration.java · 518 B

From the archive jmud-0_11.tgz

Download the archive   « Back to the archive contents

package util.nice;

import java.util.NoSuchElementException;

public class NiceVectorEnumeration implements NiceEnumeration {

  private NiceVector vect   = null;
  private int    cursor = 0;

  public NiceVectorEnumeration(NiceVector v) {
    vect = v;
  }

  public boolean hasMoreElements() {
    return cursor < vect.getSize();
  }

  public Niceable nextElement() throws NoSuchElementException {
    if (!hasMoreElements())
      throw new NoSuchElementException();

    return vect.getElementAt(cursor++);
  }
}

Site Stats

Snippets: 1791
Codebases: 571