com.jpemartin.jgt
Class UnionIterator<T>
java.lang.Object
com.jpemartin.jgt.UnionIterator<T>
- All Implemented Interfaces:
- java.util.Iterator<T>
public class UnionIterator<T>
- extends java.lang.Object
- implements java.util.Iterator<T>
The UnionIterator combines iterator to creates a single new iterator
that goes through each iterator in the list.
Unlike Iterator, here you have to indicate which type is iterated over
(it's optional for Iterator). Here's an example:
UnionIterator tots = new UnionIterator(goodGuys,badGuys);
- Author:
- jpmartin
|
Constructor Summary |
UnionIterator(java.util.Iterator<T>... iterators)
Give several iterators to the ctor, and you get an iterator that goes
through all the iterators you gave. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UnionIterator
public UnionIterator(java.util.Iterator<T>... iterators)
- Give several iterators to the ctor, and you get an iterator that goes
through all the iterators you gave.
hasNext
public boolean hasNext()
- Specified by:
hasNext in interface java.util.Iterator<T>
next
public T next()
- Specified by:
next in interface java.util.Iterator<T>
remove
public void remove()
- Specified by:
remove in interface java.util.Iterator<T>