Class ZippingIterator<E>
java.lang.Object
org.apache.commons.collections4.iterators.ZippingIterator<E>
- Type Parameters:
- E- the type of elements returned by this iterator.
- All Implemented Interfaces:
- Iterator<E>
Provides an interleaved iteration over the elements contained in a
 collection of Iterators.
 
 Given two Iterator instances A and B, the
 next() method on this iterator will switch between A.next()
 and B.next() until both iterators are exhausted.
 
- Since:
- 4.1
- 
Constructor SummaryConstructorsConstructorDescriptionZippingIterator(Iterator<? extends E>... iterators) Constructs a newZippingIteratorthat will provide interleaved iteration of the specified iterators.ZippingIterator(Iterator<? extends E> a, Iterator<? extends E> b) Constructs a newZippingIteratorthat will provide interleaved iteration over the two given iterators.Constructs a newZippingIteratorthat will provide interleaved iteration over the three given iterators.
- 
Method SummaryMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.IteratorforEachRemaining
- 
Constructor Details- 
ZippingIteratorConstructs a newZippingIteratorthat will provide interleaved iteration of the specified iterators.- Parameters:
- iterators- the array of iterators
- Throws:
- NullPointerException- if any iterator is null
 
- 
ZippingIteratorConstructs a newZippingIteratorthat will provide interleaved iteration over the two given iterators.- Parameters:
- a- the first child iterator
- b- the second child iterator
- Throws:
- NullPointerException- if either iterator is null
 
- 
ZippingIteratorConstructs a newZippingIteratorthat will provide interleaved iteration over the three given iterators.- Parameters:
- a- the first child iterator
- b- the second child iterator
- c- the third child iterator
- Throws:
- NullPointerException- if either iterator is null
 
 
- 
- 
Method Details- 
hasNext
- 
nextReturns the next element from a child iterator.- Specified by:
- nextin interface- Iterator<E>
- Returns:
- the next interleaved element
- Throws:
- NoSuchElementException- if no child iterator has any more elements
 
- 
removeRemoves the last returned element from the child iterator that produced it.- Specified by:
- removein interface- Iterator<E>
- Throws:
- IllegalStateException- if there is no last returned element, or if the last returned element has already been removed
 
 
-