Interface CollectionRunner.ElementCollector<E,​A>

  • Enclosing class:
    CollectionRunner<E>

    public static interface CollectionRunner.ElementCollector<E,​A>
    Interface to define a collection operation for use with this class. It resembles SplitCollector, but does not subclass it, since the elements it accumulates are not Splittables.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void accumulate​(E element, A accumulator)
      Consumes an element, accumulating it into the supplied accumulator.
      A combine​(A acc1, A acc2)
      Combines the content of two accumulators.
      A createAccumulator()
      Returns a new accumulator into which results can be collected.
    • Method Detail

      • 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​(E element,
                        A accumulator)
        Consumes an element, accumulating it into the supplied accumulator.
        Parameters:
        element - object to accumulate
        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