java.lang.Object
org.jdaemon.util.iterator.CompoundIterator
- All Implemented Interfaces:
- java.util.Iterator
- public class CompoundIterator
- extends java.lang.Object
- implements java.util.Iterator
Takes two iterators and turns them into a single iterator
Elements in the enumeration A will be returned until there are none
left; After that, elements in the enumeration B will be returned.
- Version:
|
Method Summary |
boolean |
hasNext()
Test for more elements
true if more elements exist in either iterator A or B |
java.lang.Object |
next()
Obtain the next element in the collection. |
void |
remove()
Remove from the underlying collection the last element returned by next
(optional operation). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
a
private java.util.Iterator a
- Iterator A
b
private java.util.Iterator b
- Iterator B
CompoundIterator
public CompoundIterator(java.util.Iterator a,
java.util.Iterator b)
- Creates new CompoundIterator
hasNext
public boolean hasNext()
- Test for more elements
true if more elements exist in either iterator A or B
- Specified by:
hasNext in interface java.util.Iterator
next
public java.lang.Object next()
- Description copied from interface:
java.util.Iterator
- Obtain the next element in the collection.
- Specified by:
next in interface java.util.Iterator
remove
public void remove()
- Description copied from interface:
java.util.Iterator
- Remove from the underlying collection the last element returned by next
(optional operation). This method can be called only once after each
call to
next(). It does not affect what will be returned
by subsequent calls to next.
- Specified by:
remove in interface java.util.Iterator