org.omnaest.utils.structure.iterator
Class ChainedIterator<E>

java.lang.Object
  extended by org.omnaest.utils.structure.iterator.ChainedIterator<E>
Type Parameters:
E -
All Implemented Interfaces:
Iterator<E>

public class ChainedIterator<E>
extends Object
implements Iterator<E>

A Iterator which is based on a chain of other Iterator instances. All Iterators are traversed in their order.

The hasNext() will be true as long as at least one remaining Iterator instance returns true for its Iterator.hasNext() function.

Author:
Omnaest
See Also:
Iterator, ChainedListIterator

Field Summary
protected  IteratorDecoratorSwitchable<E> iteratorDecoratorSwitchable
           
 
Constructor Summary
ChainedIterator(Iterable<E>... iterables)
           
ChainedIterator(Iterator<E>... iterators)
           
 
Method Summary
 boolean hasNext()
           
 E next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iteratorDecoratorSwitchable

protected final IteratorDecoratorSwitchable<E> iteratorDecoratorSwitchable
Constructor Detail

ChainedIterator

public ChainedIterator(Iterator<E>... iterators)
Parameters:
iterators - Iterator
See Also:
ChainedIterator

ChainedIterator

public ChainedIterator(Iterable<E>... iterables)
Parameters:
iterables - Iterable
See Also:
ChainedIterator
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<E>

next

public E next()
Specified by:
next in interface Iterator<E>

remove

public void remove()
Specified by:
remove in interface Iterator<E>


Copyright © 2013. All Rights Reserved.