org.apache.lucene.util
Class MergedIterator<T extends Comparable<T>>

java.lang.Object
  extended by org.apache.lucene.util.MergedIterator<T>
All Implemented Interfaces:
Iterator<T>

public final class MergedIterator<T extends Comparable<T>>
extends Object
implements Iterator<T>

Provides a merged sorted view from several sorted iterators.

If built with removeDuplicates set to true and an element appears in multiple iterators then it is deduplicated, that is this iterator returns the sorted union of elements.

If built with removeDuplicates set to false then all elements in all iterators are returned.

Caveats:

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

Constructor Summary
MergedIterator(boolean removeDuplicates, Iterator<T>... iterators)
           
MergedIterator(Iterator<T>... iterators)
           
 
Method Summary
 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

MergedIterator

public MergedIterator(Iterator<T>... iterators)

MergedIterator

public MergedIterator(boolean removeDuplicates,
                      Iterator<T>... iterators)
Method Detail

hasNext

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

next

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

remove

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


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.