|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ccg.util.EnumerationIterator
public final class EnumerationIterator
Makes a Iterator out of a Enumeration.
This simple class provides the wrapper methods around a Enumeration object such that it can be passed as a Iterator when these conditions arise.
For example, if you are updating a old method "fooOld" which takes a enumeration as a parameter, and it would like to make use of a old method "fooOld" which requires a Iterator, you might use this class in the following manner:
public void fooOld(Enumeration e) {
// Convert enumeration to iterator and invoke old method
fooNew(new EnumerationIterator(e));
}
public void fooNew(Iterator i) {
... // New API code that updates to fooOld wants to use
}
| Constructor Summary | |
|---|---|
EnumerationIterator(Enumeration i)
Constructs a Iterator object from a Enumeration. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Determine if the Iterator has more elements left in it. |
Object |
next()
Get the next element from the Iterator. |
void |
remove()
Implementation of the 'remove' method from the Iterator interface. |
String |
toString()
Get string representation of object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EnumerationIterator(Enumeration i)
Iterator object from a Enumeration.
i - The Enumeration to make a Iterator out of - must not be null.| Method Detail |
|---|
public boolean hasNext()
Iterator has more elements left in it.
hasNext in interface Iteratorpublic Object next()
Iterator.
As this method retrieves the next element of the iterator, one
should only use it if the hasNext method
returned true.
next in interface Iteratorpublic void remove()
The Iterator interface requires that all implementations provide a 'remove' method. However, the 'remove' method is not required to do anything. Since a Enumeration does not have a corresponding function, this does nothing.
remove in interface Iteratorpublic String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||