*** empty log message ***
[IRC.git] / Robust / src / ClassLibrary / VectorIterator.java
1 public class VectorIterator extends Iterator {
2   private int pos;
3   private int size;
4   private Vector list;
5
6   public VectorIterator(Vector v) {
7     this.list = v;
8     this.pos = 0;
9     this.size = this.list.size();
10   }
11
12   /**
13    * Tests to see if there are any more objects to
14    * return.
15    *
16    * @return True if the end of the list has not yet been
17    *         reached.
18    */
19   public boolean hasNext()
20   {
21     return pos < size;
22   }
23
24   /**
25    * Retrieves the next object from the list.
26    *
27    * @return The next object.
28    */
29   public Object next()
30   {
31     if (pos == size) {
32       return null;  //since we can't throw anything...
33     }
34     return this.list.get(pos++);
35   }
36 }