wt.util
Class EnumeratorVector
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.Vector
wt.util.EnumeratorVector
- All Implemented Interfaces:
- Cloneable, Collection, Enumeration, List, RandomAccess, Serializable
- public class EnumeratorVector
- extends Vector
- implements Enumeration
EnumeratorVector
is wrapper class for java.util.Vector
that implements java.util.Enumeration
.
This class can be used when a Vector is called for and at the same time must be returned
as an enumeration. The problem with returning Vector.elements ()
is that
the class returned is not Serializable and therefore not appropriate for client-server
communication.
Supported API: true
Extendable: false
- See Also:
Vector
,
Enumeration
,
Serializable
,
Serialized Form
Method Summary |
boolean |
hasMoreElements()
Determines whether there are more elements to be returned. |
Object |
nextElement()
Returns the next element of the vector. |
void |
reset()
Resets the enumeration to its first element. |
Methods inherited from class java.util.Vector |
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize |
versionID
private static final String versionID
- See Also:
- Constant Field Values
current
private int current
- Points to next object to be returned.
EnumeratorVector
public EnumeratorVector()
- No-arg constructor. Sets the next element to be returned to be the firsrt in the
wrapped vector.
EnumeratorVector
public EnumeratorVector(Vector v)
- Constructs and initializes to the vector passed as argument.
Supported API: true
hasMoreElements
public boolean hasMoreElements()
- Determines whether there are more elements to be returned.
Supported API: true
- Specified by:
hasMoreElements
in interface Enumeration
- Returns:
- true if there are more lements; false otherwise.
nextElement
public Object nextElement()
throws NoSuchElementException
- Returns the next element of the vector. Objects are returned in the order
they are added to the vector (FIFO).
Supported API: true
- Specified by:
nextElement
in interface Enumeration
- Returns:
- the next object in the enumeration
- Throws:
NoSuchElementException
- if there aren't objects to be returned.
reset
public void reset()
- Resets the enumeration to its first element.
Supported API: true