de.hpi.fgis.dude.util
Class ChainedIterator<T>

java.lang.Object
  extended by de.hpi.fgis.dude.util.AbstractIterator<T>
      extended by de.hpi.fgis.dude.util.ChainedIterator<T>
Type Parameters:
T - the type of the Iterator
All Implemented Interfaces:
Iterator<T>

public class ChainedIterator<T>
extends AbstractIterator<T>

Logically concatenates several Iterators to one big iterator.

Author:
Arvid.Heise

Constructor Summary
ChainedIterator(Iterable<Iterator<T>> iterators)
          Initializes the chained iterator from multiple single iterators.
ChainedIterator(Iterator<Iterator<T>> iterators)
          Initializes the chained iterator from multiple single iterators.
ChainedIterator(Iterator<T>... iterators)
          Initializes the chained iterator from multiple single iterators.
 
Method Summary
static
<T> ChainedIterator<T>
fromIterables(Iterable<Iterable<T>> iterables)
          Creates a chained iterator from Iterables.
protected  T loadNextElement()
          Returns the element of the next iteration step.
 
Methods inherited from class de.hpi.fgis.dude.util.AbstractIterator
hasNext, next, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainedIterator

public ChainedIterator(Iterable<Iterator<T>> iterators)
Initializes the chained iterator from multiple single iterators.

Parameters:
iterators - the iterators to chain

ChainedIterator

public ChainedIterator(Iterator<Iterator<T>> iterators)
Initializes the chained iterator from multiple single iterators.

Parameters:
iterators - the iterators to chain

ChainedIterator

public ChainedIterator(Iterator<T>... iterators)
Initializes the chained iterator from multiple single iterators.

Parameters:
iterators - the iterators to chain
Method Detail

fromIterables

public static <T> ChainedIterator<T> fromIterables(Iterable<Iterable<T>> iterables)
Creates a chained iterator from Iterables.

Type Parameters:
T - the type of the Iterables
Parameters:
iterables - the iterables from which to create a ChainedIterator.
Returns:
a ChainedIterator iterating over all iterables

loadNextElement

protected T loadNextElement()
Description copied from class: AbstractIterator
Returns the element of the next iteration step. This method needs to be implemented by each sub-class.

Specified by:
loadNextElement in class AbstractIterator<T>
Returns:
The next element.


Copyright © 2011 Hasso Plattner Institute - Chair of Information Systems. All Rights Reserved.