|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.clapper.util.misc.EnumerationIterator<T>
public class EnumerationIterator<T>
The EnumerationIterator class is an adapter that makes a java.util.Enumeration object look and behave like a java.util.Iterator objects. The EnumerationIterator class implements the Iterator interface and wraps an existing Enumeration object. This class is the conceptual opposite of the Collections.enumeration() method in the java.util package.
You can also use an instance of this class to wrap an Enumeration for use in a JDK 1.5-style for each loop. For instance:
Vectorv = ... for (String s : new EnumerationIterator (v.elements())) ...
Iterator,
Enumeration| Constructor Summary | |
|---|---|
EnumerationIterator(java.util.Enumeration<T> enumeration)
Allocate a new EnumerationIterator object that will forward its calls to the specified Enumeration. |
|
| Method Summary | |
|---|---|
boolean |
hasNext()
Determine whether the underlying Enumeration has more elements. |
java.util.Iterator<T> |
iterator()
Returns this iterator. |
T |
next()
Get the next element from the underlying Enumeration. |
void |
remove()
Removes from the underlying collection the last element returned by the iterator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EnumerationIterator(java.util.Enumeration<T> enumeration)
enumeration - The Enumeration to which to forward calls| Method Detail |
|---|
public boolean hasNext()
hasNext in interface java.util.Iterator<T>next(),
Enumeration.hasMoreElements()public java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>
public T next()
throws java.util.NoSuchElementException
next in interface java.util.Iterator<T>java.util.NoSuchElementException - No more elements existIterator.next()
public void remove()
throws java.lang.IllegalStateException,
java.lang.UnsupportedOperationException
remove in interface java.util.Iterator<T>java.lang.IllegalStateException - doesn't
java.lang.UnsupportedOperationException - unconditionally
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||