MergeIterator (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.utils

## Class MergeIterator<In,Out>

- java.lang.Object
- - org.apache.cassandra.utils.AbstractIterator<Out>
  - - org.apache.cassandra.utils.MergeIterator<In,Out>

- All Implemented Interfaces:
    com.google.common.collect.PeekingIterator<Out>, java.lang.AutoCloseable, java.util.Iterator<Out>, CloseableIterator<Out>, IMergeIterator<In,Out>

      public abstract class MergeIterator<In,Out>
      extends AbstractIterator<Out>
      implements IMergeIterator<In,Out>

  Merges sorted input iterators which individually contain unique items.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected static class` | `MergeIterator.Candidate<In>`
    `static class` | `MergeIterator.Reducer<In,Out>` Accumulator that collects values of type A, and outputs a value of type B.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<? extends java.util.Iterator<In>>` | `iterators`
    `protected MergeIterator.Reducer<In,Out>` | `reducer`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `MergeIterator(java.util.List<? extends java.util.Iterator<In>> iters, MergeIterator.Reducer<In,Out> reducer)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `static <In,Out> MergeIterator<In,Out>` | `get(java.util.List<? extends java.util.Iterator<In>> sources, java.util.Comparator<? super In> comparator, MergeIterator.Reducer<In,Out> reducer)`
    `java.lang.Iterable<? extends java.util.Iterator<In>>` | `iterators()`

    - ### Methods inherited from class org.apache.cassandra.utils.AbstractIterator

      `computeNext, endOfData, hasNext, next, peek, remove`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Iterator

      `forEachRemaining, hasNext, next, remove`

- - ### Field Detail

    - #### reducer

          protected final MergeIterator.Reducer<In,Out> reducer

    - #### iterators

          protected final java.util.List<? extends java.util.Iterator<In>> iterators

  - ### Constructor Detail

    - #### MergeIterator

          protected MergeIterator(java.util.List<? extends java.util.Iterator<In>> iters,
                                  MergeIterator.Reducer<In,Out> reducer)

  - ### Method Detail

    - #### get

          public static <In,Out> MergeIterator<In,Out> get(java.util.List<? extends java.util.Iterator<In>> sources,
                                                           java.util.Comparator<? super In> comparator,
                                                           MergeIterator.Reducer<In,Out> reducer)

    - #### iterators

          public java.lang.Iterable<? extends java.util.Iterator<In>> iterators()

      Specified by:
        `iterators` in interface `IMergeIterator<In,Out>`

    - #### close

          public void close()

      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in interface `CloseableIterator<Out>`

Copyright © 2018 The Apache Software Foundation