Interface CombinerAggregator<T,​A,​R>

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      A apply​(A accumulator, T value)
      Updates the accumulator by applying the current accumulator with the value.
      A init()
      The initial value of the accumulator to start with.
      A merge​(A accum1, A accum2)
      Merges two accumulators and returns the merged accumulator.
      static <T,​R>
      CombinerAggregator<T,​R,​R>
      of​(R initialValue, BiFunction<? super R,​? super T,​? extends R> accumulator, BiFunction<? super R,​? super R,​? extends R> combiner)
      A static factory to create a CombinerAggregator based on initial value, accumulator and combiner.
      R result​(A accum)
      Produces a result value out of the accumulator.
    • Method Detail

      • of

        static <T,​R> CombinerAggregator<T,​R,​R> of​(R initialValue,
                                                                    BiFunction<? super R,​? super T,​? extends R> accumulator,
                                                                    BiFunction<? super R,​? super R,​? extends R> combiner)
        A static factory to create a CombinerAggregator based on initial value, accumulator and combiner.
        Parameters:
        initialValue - the initial value of the result to start with
        accumulator - a function that accumulates values into a partial result
        combiner - a function that combines partially accumulated results
        Returns:
        the CombinerAggregator
      • init

        A init()
        The initial value of the accumulator to start with.
        Returns:
        the initial value of the accumulator
      • apply

        A apply​(A accumulator,
                T value)
        Updates the accumulator by applying the current accumulator with the value.
        Parameters:
        accumulator - the current accumulator
        value - the value
        Returns:
        the updated accumulator
      • merge

        A merge​(A accum1,
                A accum2)
        Merges two accumulators and returns the merged accumulator.
        Parameters:
        accum1 - the first accumulator
        accum2 - the second accumulator
        Returns:
        the merged accumulator
      • result

        R result​(A accum)
        Produces a result value out of the accumulator.
        Parameters:
        accum - the accumulator
        Returns:
        the result