MergeIterator.Reducer (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.utils

## Class MergeIterator.Reducer<In,Out>

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

- Direct Known Subclasses:
    CompactionIterable.Reducer
  Enclosing class:
    MergeIterator<In,Out>

      public abstract static class MergeIterator.Reducer<In,Out>
      extends java.lang.Object

  Accumulator that collects values of type A, and outputs a value of type B.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MergeIterator.Reducer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` May be overridden by implementations that require cleaning up after use
    `protected abstract Out` | `getReduced()`
    `protected void` | `onKeyChange()` Called at the beginning of each new key, before any reduce is called.
    `abstract void` | `reduce(In current)` combine this object with the previous ones.
    `boolean` | `trivialReduceIsTrivial()`

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

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

- - ### Constructor Detail

    - #### MergeIterator.Reducer

          public MergeIterator.Reducer()

  - ### Method Detail

    - #### trivialReduceIsTrivial

          public boolean trivialReduceIsTrivial()

      Returns:
        true if Out is the same as In for the case of a single source iterator

    - #### reduce

          public abstract void reduce(In current)

      combine this object with the previous ones. intermediate state is up to your implementation.

    - #### getReduced

          protected abstract Out getReduced()

      Returns:
        The last object computed by reduce

    - #### onKeyChange

          protected void onKeyChange()

      Called at the beginning of each new key, before any reduce is called. To be overridden by implementing classes.

    - #### close

          public void close()

      May be overridden by implementations that require cleaning up after use

Copyright © 2014 The Apache Software Foundation