org.apache.jackrabbit.commons.iterator
Class LazyIteratorChain<T>

java.lang.Object
  extended by org.apache.jackrabbit.commons.iterator.LazyIteratorChain<T>
Type Parameters:
T - type of values iterating over
All Implemented Interfaces:
Iterator<T>

public class LazyIteratorChain<T>
extends Object
implements Iterator<T>

This class implements the concatenation of iterators. The implementation is lazy in the sense that advancing of any iterator is deferred as much as possible. Specifically no iterator is fully unwrapped at one single point of time.


Constructor Summary
LazyIteratorChain(Iterator<Iterator<T>> iterators)
           
LazyIteratorChain(Iterator<T>... iterators)
           
 
Method Summary
static
<T> Iterator<T>
chain(Iterator<Iterator<T>> iterators)
          Returns the concatenation of all iterators in iterators.
static
<T> Iterator<T>
chain(Iterator<T>... iterators)
          Returns the concatenation of all iterators in iterators.
 boolean hasNext()
           
 T next()
           
 void remove()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyIteratorChain

public LazyIteratorChain(Iterator<Iterator<T>> iterators)

LazyIteratorChain

public LazyIteratorChain(Iterator<T>... iterators)
Method Detail

chain

public static <T> Iterator<T> chain(Iterator<Iterator<T>> iterators)
Returns the concatenation of all iterators in iterators.

Type Parameters:
T -
Parameters:
iterators -
Returns:

chain

public static <T> Iterator<T> chain(Iterator<T>... iterators)
Returns the concatenation of all iterators in iterators.

Type Parameters:
T -
Parameters:
iterators -
Returns:

hasNext

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

next

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

remove

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


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.