Class MergeIterator<T>

java.lang.Object
org.apache.druid.java.util.common.guava.MergeIterator<T>
All Implemented Interfaces:
Iterator<T>

public class MergeIterator<T> extends Object implements Iterator<T>
Iterator that merges a collection of sorted iterators using a comparator. Similar to Guava's MergingIterator, but avoids calling next() on any iterator prior to returning the value returned by the previous call to next(). This is important when merging iterators that reuse container objects across calls to next(). Used by Utils.mergeSorted(Iterable, Comparator).
  • Constructor Details

  • Method Details

    • 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>