- All Implemented Interfaces:
- com.metamx.common.guava.Sequence<T>
public class OrderedMergeSequence<T>
extends Object
implements com.metamx.common.guava.Sequence<T>
An OrderedMergeIterator is an iterator that merges together multiple sorted iterators. It is written assuming
that the input Iterators are provided in order. That is, it places an extra restriction in the input iterators.
Normally a merge operation could operate with the actual input iterators in any order as long as the actual values
in the iterators are sorted. This requires that not only the individual values be sorted, but that the iterators
be provided in the order of the first element of each iterator.
If this doesn't make sense, check out OrderedMergeSequenceTest.testScrewsUpOnOutOfOrderBeginningOfList()
It places this extra restriction on the input data in order to implement an optimization that allows it to
remain as lazy as possible in the face of a common case where the iterators are just appended one after the other.