org.apache.commons.collections.iterators
Class IteratorEnumeration
java.lang.Object
org.apache.commons.collections.iterators.IteratorEnumeration
- All Implemented Interfaces:
- java.util.Enumeration
- Direct Known Subclasses:
- IteratorEnumeration
- public class IteratorEnumeration
- extends java.lang.Object
- implements java.util.Enumeration
Adapter to make an Iterator instance appear to be an Enumeration instances
- Since:
- 1.0
- Author:
| Field Summary |
private java.util.Iterator |
iterator
|
| Constructor Summary |
IteratorEnumeration()
Constructs a new IteratorEnumeration that will not function until setIterator is invoked. |
IteratorEnumeration(java.util.Iterator iterator)
Constructs a new IteratorEnumeration that will use the given iterator. |
| Method Summary |
java.util.Iterator |
getIterator()
Returns the underlying iterator. |
boolean |
hasMoreElements()
Returns true if the underlying iterator has more elements. |
java.lang.Object |
nextElement()
Returns the next element from the underlying iterator. |
void |
setIterator(java.util.Iterator iterator)
Sets the underlying iterator. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
iterator
private java.util.Iterator iterator
-
IteratorEnumeration
public IteratorEnumeration()
-
Constructs a new
IteratorEnumeration that will not function until setIterator is invoked.
IteratorEnumeration
public IteratorEnumeration(java.util.Iterator iterator)
-
Constructs a new
IteratorEnumeration that will use the given iterator.
- Parameters:
iterator - the iterator to use
hasMoreElements
public boolean hasMoreElements()
-
Returns true if the underlying iterator has more elements.
-
- Specified by:
hasMoreElements in interface java.util.Enumeration
-
- Returns:
- true if the underlying iterator has more elements
nextElement
public java.lang.Object nextElement()
-
Returns the next element from the underlying iterator.
-
- Specified by:
nextElement in interface java.util.Enumeration
-
- Returns:
- the next element from the underlying iterator.
- Throws:
NoSuchElementException - if the underlying iterator has no more elements
getIterator
public java.util.Iterator getIterator()
-
Returns the underlying iterator.
-
-
- Returns:
- the underlying iterator
setIterator
public void setIterator(java.util.Iterator iterator)
-
Sets the underlying iterator.
-
-
- Parameters:
iterator - the new underlying iterator
Please see keelframework.org for information about new Keel releases.