SerializableEnumeration Class
DEPRECATED
- public class SerializableEnumeration
extends Object
implements Enumeration
, Serializable
An implementation of the Enumeration interface which is Serializable.
Note: Since most Enumeration implementations aren't Serializable
(including Vector.elements() and Collections.enumeration()), we need this
to return Enumerations from SessionBeans and other RemoteObjects. Most
collection classes are Serializable, so that's nice. However, to make life
easier, this uses the underlying Collection's iterator, most of which also
aren't Serializable. Therefore, if a partial enumeration has been done
before this Enumeration is serialized, the enumeration will start over
on the other side because this internally keeps the Collection's Iterator
in a transient field (since Iterator aren't generally Serializable).
This is also intentionally not thread-safe.
-
Hierarchy
-
Object
SerializableEnumeration
-
All Implemented Interfaces
-
Enumeration
, Serializable
protected Collection |
-
c
- The Collection we're fronting for.
|
protected transient Iterator |
-
i
- The current iterator.
|
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
c
protected Collection
c
- The Collection we're fronting for.
i
protected transient Iterator
i
- The current iterator.
SerializableEnumeration
public SerializableEnumeration(Collection
c)
- Constructor.
hasMoreElements() Method
public boolean hasMoreElements()
Tell if this enumeration has more elements.
nextElement() Method
public Object
nextElement()
Get the next element in the enumeration.