/** * Constructs a new <code>ZippingIterator</code> that will provide * interleaved iteration of the specified iterators. * * @param iterators the array of iterators * @throws NullPointerException if any iterator is null */ public ZippingIterator(final Iterator<? extends E>... iterators) { // create a mutable list to be able to remove exhausted iterators final List<Iterator<? extends E>> list = new ArrayList<>(); for (final Iterator<? extends E> iterator : iterators) { if (iterator == null) { throw new NullPointerException("Iterator must not be null."); } list.add(iterator); } this.iterators = FluentIterable.of(list).loop().iterator(); }