Interface SplitCollector<S extends Splittable<S>,A>

Type Parameters:
S - splittable content type
A - accumulator type

public interface SplitCollector<S extends Splittable<S>,A>
Defines an object that can collect values from a Splittable into an accumulator. The order of the split items is not considered significant, so splittables may be presented to accumulator instances in any order.
Since:
12 Sep 2019
Author:
Mark Taylor
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    accumulate(S splittable, A accumulator)
    Consumes the content of a splittable, collecting results into the supplied accumulator.
    combine(A acc1, A acc2)
    Combines the content of two accumulators.
    Returns a new accumulator into which results can be collected.
  • Method Details

    • createAccumulator

      A createAccumulator()
      Returns a new accumulator into which results can be collected. Accumulator instances may only be used from one thread at any one time.
      Returns:
      new accumulator
    • accumulate

      void accumulate(S splittable, A accumulator)
      Consumes the content of a splittable, collecting results into the supplied accumulator. This method may not be called concurrently on the same splittable.
      Parameters:
      splittable - splittable object
      accumulator - accumulator
    • combine

      A combine(A acc1, A acc2)
      Combines the content of two accumulators. The returned value may or may not be the same object as one of the input values. The input values should not be used following this call. The sequence of the input values is not significant.
      Parameters:
      acc1 - one input accumulator
      acc2 - other input accumulator
      Returns:
      accumulator containing the combined result of the inputs