com.hazelcast.jet.aggregate

## Class AggregateOperations

- java.lang.Object
- - com.hazelcast.jet.aggregate.AggregateOperations

-     public final class AggregateOperations
      extends Object

  Utility class with factory methods for several useful aggregate operations. See the Javadoc on `AggregateOperation`. You can also create your own aggregate operation using the `builder object`.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <T0,T1,A0,A1,R0,R1> AggregateOperation2<T0,T1,Tuple2<A0,A1>,Tuple2<R0,R1>>` | `aggregateOperation2(AggregateOperation1<? super T0,A0,? extends R0> op0, AggregateOperation1<? super T1,A1,? extends R1> op1)` Convenience for `aggregateOperation2(aggrOp0, aggrOp1, finishFn)` that outputs a `Tuple2(result0, result1)`.
    `static <T0,A0,R0,T1,A1,R1,R> AggregateOperation2<T0,T1,Tuple2<A0,A1>,R>` | `aggregateOperation2(AggregateOperation1<? super T0,A0,? extends R0> op0, AggregateOperation1<? super T1,A1,? extends R1> op1, DistributedBiFunction<? super R0,? super R1,? extends R> exportFinishFn)` Returns an aggregate operation that is a composite of two independent aggregate operations, each one accepting its own input.
    `static <T0,T1,T2,A0,A1,A2,R0,R1,R2> AggregateOperation3<T0,T1,T2,Tuple3<A0,A1,A2>,Tuple3<R0,R1,R2>>` | `aggregateOperation3(AggregateOperation1<? super T0,A0,? extends R0> op0, AggregateOperation1<? super T1,A1,? extends R1> op1, AggregateOperation1<? super T2,A2,? extends R2> op2)` Convenience for `aggregateOperation3(aggrOp0, aggrOp1, aggrOp2, finishFn)` that outputs a `Tuple3(result0, result1, result2)`.
    `static <T0,T1,T2,A0,A1,A2,R0,R1,R2,R> AggregateOperation3<T0,T1,T2,Tuple3<A0,A1,A2>,R>` | `aggregateOperation3(AggregateOperation1<? super T0,A0,? extends R0> op0, AggregateOperation1<? super T1,A1,? extends R1> op1, AggregateOperation1<? super T2,A2,? extends R2> op2, DistributedTriFunction<? super R0,? super R1,? super R2,? extends R> exportFinishFn)` Returns an aggregate operation that is a composite of three independent aggregate operations, each one accepting its own input.
    `static <T,A0,A1,A2,R0,R1,R2> AggregateOperation1<T,Tuple3<A0,A1,A2>,Tuple3<R0,R1,R2>>` | `allOf(AggregateOperation1<? super T,A0,? extends R0> op0, AggregateOperation1<? super T,A1,? extends R1> op1, AggregateOperation1<? super T,A2,? extends R2> op2)` Convenience for `allOf(AggregateOperation1, AggregateOperation1, AggregateOperation1, DistributedTriFunction)` with identity finisher.
    `static <T,A0,A1,A2,R0,R1,R2,R> AggregateOperation1<T,Tuple3<A0,A1,A2>,R>` | `allOf(AggregateOperation1<? super T,A0,? extends R0> op0, AggregateOperation1<? super T,A1,? extends R1> op1, AggregateOperation1<? super T,A2,? extends R2> op2, DistributedTriFunction<? super R0,? super R1,? super R2,? extends R> exportFinishFn)` Returns an aggregate operation that is a composite of three aggregate operations.
    `static <T,A0,A1,R0,R1,R> AggregateOperation1<T,Tuple2<A0,A1>,R>` | `allOf(AggregateOperation1<? super T,A0,? extends R0> op0, AggregateOperation1<? super T,A1,? extends R1> op1, DistributedBiFunction<? super R0,? super R1,? extends R> exportFinishFn)` Returns an aggregate operation that is a composite of two aggregate operations.
    `static <T,A0,A1,R0,R1> AggregateOperation1<T,Tuple2<A0,A1>,Tuple2<R0,R1>>` | `allOf(AggregateOperation1<? super T,A0,R0> op1, AggregateOperation1<? super T,A1,R1> op2)` Convenience for `allOf(AggregateOperation1, AggregateOperation1, DistributedBiFunction)` with identity finish.
    `static <T> AllOfAggregationBuilder<T>` | `allOfBuilder()` Returns a builder object that helps you create a composite of multiple aggregate operations.
    `static <T> AggregateOperation1<T,LongDoubleAccumulator,Double>` | `averagingDouble(DistributedToDoubleFunction<? super T> getDoubleValueFn)` Returns an aggregate operation that computes the arithmetic mean of the `double` values it obtains by applying `getDoubleValueFn` to each item.
    `static <T> AggregateOperation1<T,LongLongAccumulator,Double>` | `averagingLong(DistributedToLongFunction<? super T> getLongValueFn)` Returns an aggregate operation that computes the arithmetic mean of the `long` values it obtains by applying `getLongValueFn` to each item.
    `static <T> AggregateOperation1<T,PriorityQueue<T>,List<T>>` | `bottomN(int n, DistributedComparator<? super T> comparator)` Returns an aggregate operation that computes the bottom `n` items calculated according to the given `comparator`.
    `static CoAggregateOperationBuilder` | `coAggregateOperationBuilder()` Returns a builder object that offers a step-by-step fluent API to create an aggregate operation that accepts multiple inputs.
    `static AggregateOperation1<CharSequence,StringBuilder,String>` | `concatenating()` Returns an aggregate operation that concatenates the input items into a string.
    `static AggregateOperation1<CharSequence,StringBuilder,String>` | `concatenating(CharSequence delimiter)` Returns an aggregate operation that concatenates the input items into a string with the given `delimiter`.
    `static AggregateOperation1<CharSequence,StringBuilder,String>` | `concatenating(CharSequence delimiter, CharSequence prefix, CharSequence suffix)` Returns an aggregate operation that concatenates the input items into a string with the given `delimiter`.
    `static <T> AggregateOperation1<T,LongAccumulator,Long>` | `counting()` Returns an aggregate operation that computes the number of items.
    `static <T,K> AggregateOperation1<T,Map<K,List<T>>,Map<K,List<T>>>` | `groupingBy(DistributedFunction<? super T,? extends K> keyFn)` Returns an `AggregateOperation1` that accumulates the items into a `HashMap` where the key is the result of applying `keyFn` and the value is a list of the items with that key.
    `static <T,K,A,R> AggregateOperation1<T,Map<K,A>,Map<K,R>>` | `groupingBy(DistributedFunction<? super T,? extends K> keyFn, AggregateOperation1<? super T,A,R> downstream)` Returns an `AggregateOperation1` that accumulates the items into a `HashMap` where the key is the result of applying `keyFn` and the value is the result of applying the downstream aggregate operation to the items with that key.
    `static <T,K,R,A,M extends Map<K,R>> AggregateOperation1<T,Map<K,A>,M>` | `groupingBy(DistributedFunction<? super T,? extends K> keyFn, DistributedSupplier<M> createMapFn, AggregateOperation1<? super T,A,R> downstream)` Returns an `AggregateOperation1` that accumulates the items into a `Map` (as obtained from `createMapFn`) where the key is the result of applying `keyFn` and the value is the result of applying the downstream aggregate operation to the items with that key.
    `static <T> AggregateOperation1<T,LinTrendAccumulator,Double>` | `linearTrend(DistributedToLongFunction<T> getXFn, DistributedToLongFunction<T> getYFn)` Returns an aggregate operation that computes a linear trend on the items.
    `static <T,U,A,R> AggregateOperation1<T,A,R>` | `mapping(DistributedFunction<? super T,? extends U> mapFn, AggregateOperation1<? super U,A,? extends R> downstream)` Adapts an aggregate operation accepting items of type `U` to one accepting items of type `T` by applying a mapping function to each item before accumulation.
    `static <T> AggregateOperation1<T,MutableReference<T>,T>` | `maxBy(DistributedComparator<? super T> comparator)` Returns an aggregate operation that computes the maximal item according to the given `comparator`.
    `static <T> AggregateOperation1<T,MutableReference<T>,T>` | `minBy(DistributedComparator<? super T> comparator)` Returns an aggregate operation that computes the minimal item according to the given `comparator`.
    `static <T> AggregateOperation1<T,MutableReference<T>,T>` | `pickAny()` Returns an aggregate operation whose result is an arbitrary item it observed, or `null` if it observed no items.
    `static <T,A> AggregateOperation1<T,MutableReference<A>,A>` | `reducing(A emptyAccValue, DistributedFunction<? super T,? extends A> toAccValueFn, DistributedBinaryOperator<A> combineAccValuesFn, DistributedBinaryOperator<A> deductAccValueFn)` A reducing operation maintains an accumulated value that starts out as `emptyAccValue` and is iteratively transformed by applying `combineAccValuesFn` to it and each stream item's accumulated value, as returned from `toAccValueFn`.
    `static <T> AggregateOperation1<T,ArrayList<T>,List<T>>` | `sorting(DistributedComparator<? super T> comparator)` Returns an aggregate operation that accumulates all input items into an `ArrayList` and sorts it with the given comparator.
    `static <T> AggregateOperation1<T,DoubleAccumulator,Double>` | `summingDouble(DistributedToDoubleFunction<? super T> getDoubleValueFn)` Returns an aggregate operation that computes the sum of the `double` values it obtains by applying `getDoubleValueFn` to each item.
    `static <T> AggregateOperation1<T,LongAccumulator,Long>` | `summingLong(DistributedToLongFunction<? super T> getLongValueFn)` Returns an aggregate operation that computes the sum of the `long` values it obtains by applying `getLongValueFn` to each item.
    `static <T,C extends Collection<T>> AggregateOperation1<T,C,C>` | `toCollection(DistributedSupplier<C> createCollectionFn)` Returns an aggregate operation that accumulates the items into a `Collection`.
    `static <T> AggregateOperation1<T,List<T>,List<T>>` | `toList()` Returns an aggregate operation that accumulates the items into an `ArrayList`.
    `static <T,K,U> AggregateOperation1<T,Map<K,U>,Map<K,U>>` | `toMap(DistributedFunction<? super T,? extends K> keyFn, DistributedFunction<? super T,? extends U> valueFn)` Returns an aggregate operation that accumulates the items into a `HashMap` whose keys and values are the result of applying the provided mapping functions.
    `static <T,K,U> AggregateOperation1<T,Map<K,U>,Map<K,U>>` | `toMap(DistributedFunction<? super T,? extends K> keyFn, DistributedFunction<? super T,? extends U> valueFn, DistributedBinaryOperator<U> mergeFn)` Returns an aggregate operation that accumulates the items into a `HashMap` whose keys and values are the result of applying the provided mapping functions.
    `static <T,K,U,M extends Map<K,U>> AggregateOperation1<T,M,M>` | `toMap(DistributedFunction<? super T,? extends K> keyFn, DistributedFunction<? super T,? extends U> valueFn, DistributedBinaryOperator<U> mergeFn, DistributedSupplier<M> createMapFn)` Returns an `AggregateOperation1` that accumulates elements into a `Map` whose keys and values are the result of applying the provided mapping functions to the input elements.
    `static <T> AggregateOperation1<T,PriorityQueue<T>,List<T>>` | `topN(int n, DistributedComparator<? super T> comparator)` Returns an aggregate operation that computes the top `n` items calculated according to the given `comparator`.
    `static <T> AggregateOperation1<T,Set<T>,Set<T>>` | `toSet()` Returns an aggregate operation that accumulates the items into a `HashSet`.

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

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

- - ### Method Detail

    - #### counting

          @Nonnull
          public static <T> AggregateOperation1<T,LongAccumulator,Long> counting()

      Returns an aggregate operation that computes the number of items.

    - #### summingLong

          @Nonnull
          public static <T> AggregateOperation1<T,LongAccumulator,Long> summingLong(@Nonnull
                                                                                             DistributedToLongFunction<? super T> getLongValueFn)

      Returns an aggregate operation that computes the sum of the `long` values it obtains by applying `getLongValueFn` to each item.
      Type Parameters:
        `T` - input item type

    - #### summingDouble

          @Nonnull
          public static <T> AggregateOperation1<T,DoubleAccumulator,Double> summingDouble(@Nonnull
                                                                                                   DistributedToDoubleFunction<? super T> getDoubleValueFn)

      Returns an aggregate operation that computes the sum of the `double` values it obtains by applying `getDoubleValueFn` to each item.
      Type Parameters:
        `T` - input item type

    - #### minBy

          @Nonnull
          public static <T> AggregateOperation1<T,MutableReference<T>,T> minBy(@Nonnull
                                                                                        DistributedComparator<? super T> comparator)

      Returns an aggregate operation that computes the minimal item according to the given `comparator`.

      This aggregate operation does not implement the `deduct` primitive.

      Type Parameters:
        `T` - input item type

    - #### maxBy

          @Nonnull
          public static <T> AggregateOperation1<T,MutableReference<T>,T> maxBy(@Nonnull
                                                                                        DistributedComparator<? super T> comparator)

      Returns an aggregate operation that computes the maximal item according to the given `comparator`.

      This aggregate operation does not implement the `deduct` primitive.

      Type Parameters:
        `T` - input item type

    - #### topN

          @Nonnull
          public static <T> AggregateOperation1<T,PriorityQueue<T>,List<T>> topN(int n,
                                                                                          @Nonnull
                                                                                          DistributedComparator<? super T> comparator)

      Returns an aggregate operation that computes the top `n` items calculated according to the given `comparator`. The returned list of elements is sorted in descending order.

      This aggregate operation does not implement the `deduct` primitive.

      Type Parameters:
        `T` - input item type
      Parameters:
        `n` - number of items to return
        `comparator` - the comparator to use

    - #### bottomN

          @Nonnull
          public static <T> AggregateOperation1<T,PriorityQueue<T>,List<T>> bottomN(int n,
                                                                                             @Nonnull
                                                                                             DistributedComparator<? super T> comparator)

      Returns an aggregate operation that computes the bottom `n` items calculated according to the given `comparator`. The returned list of elements is sorted in ascending order.

      This aggregate operation does not implement the `deduct` primitive.

      Type Parameters:
        `T` - input item type
      Parameters:
        `n` - number of items to return
        `comparator` - the comparator to use

    - #### averagingLong

          @Nonnull
          public static <T> AggregateOperation1<T,LongLongAccumulator,Double> averagingLong(@Nonnull
                                                                                                     DistributedToLongFunction<? super T> getLongValueFn)

      Returns an aggregate operation that computes the arithmetic mean of the `long` values it obtains by applying `getLongValueFn` to each item.
      Type Parameters:
        `T` - input item type

    - #### averagingDouble

          @Nonnull
          public static <T> AggregateOperation1<T,LongDoubleAccumulator,Double> averagingDouble(@Nonnull
                                                                                                         DistributedToDoubleFunction<? super T> getDoubleValueFn)

      Returns an aggregate operation that computes the arithmetic mean of the `double` values it obtains by applying `getDoubleValueFn` to each item.
      Type Parameters:
        `T` - input item type

    - #### linearTrend

          @Nonnull
          public static <T> AggregateOperation1<T,LinTrendAccumulator,Double> linearTrend(@Nonnull
                                                                                                   DistributedToLongFunction<T> getXFn,
                                                                                                   @Nonnull
                                                                                                   DistributedToLongFunction<T> getYFn)

      Returns an aggregate operation that computes a linear trend on the items. The operation will produce a `double`-valued coefficient that approximates the rate of change of `y` as a function of `x`, where `x` and `y` are `long` quantities obtained by applying the two provided functions to each item.

    - #### concatenating

          public static AggregateOperation1<CharSequence,StringBuilder,String> concatenating()

      Returns an aggregate operation that concatenates the input items into a string.

    - #### concatenating

          public static AggregateOperation1<CharSequence,StringBuilder,String> concatenating(CharSequence delimiter)

      Returns an aggregate operation that concatenates the input items into a string with the given `delimiter`.

    - #### concatenating

          public static AggregateOperation1<CharSequence,StringBuilder,String> concatenating(CharSequence delimiter,
                                                                                             CharSequence prefix,
                                                                                             CharSequence suffix)

      Returns an aggregate operation that concatenates the input items into a string with the given `delimiter`. The resulting string will also have the given `prefix` and `suffix`.

    - #### mapping

          public static <T,U,A,R> AggregateOperation1<T,A,R> mapping(@Nonnull
                                                                     DistributedFunction<? super T,? extends U> mapFn,
                                                                     @Nonnull
                                                                     AggregateOperation1<? super U,A,? extends R> downstream)

      Adapts an aggregate operation accepting items of type `U` to one accepting items of type `T` by applying a mapping function to each item before accumulation.

      If the `mapFn` returns `null`, the item won't be aggregated at all. This allows applying a filter at the same time.

      Type Parameters:
        `T` - input item type
        `U` - input type of the downstream aggregate operation
        `A` - downstream operation's accumulator type
        `R` - downstream operation's result type
      Parameters:
        `mapFn` - the function to apply to input items
        `downstream` - the downstream aggregate operation

    - #### toCollection

          public static <T,C extends Collection<T>> AggregateOperation1<T,C,C> toCollection(DistributedSupplier<C> createCollectionFn)

      Returns an aggregate operation that accumulates the items into a `Collection`. It creates the collections as needed by calling the provided `createCollectionFn`.

      If you use a collection that preserves the insertion order, keep in mind that there is no specified order in which the items are aggregated.

      Type Parameters:
        `T` - input item type
        `C` - the type of the collection
      Parameters:
        `createCollectionFn` - a `Supplier` which returns a new, empty `Collection` of the appropriate type

    - #### toList

          public static <T> AggregateOperation1<T,List<T>,List<T>> toList()

      Returns an aggregate operation that accumulates the items into an `ArrayList`.
      Type Parameters:
        `T` - input item type

    - #### toSet

          public static <T> AggregateOperation1<T,Set<T>,Set<T>> toSet()

      Returns an aggregate operation that accumulates the items into a `HashSet`.
      Type Parameters:
        `T` - input item type

    - #### toMap

          public static <T,K,U> AggregateOperation1<T,Map<K,U>,Map<K,U>> toMap(DistributedFunction<? super T,? extends K> keyFn,
                                                                               DistributedFunction<? super T,? extends U> valueFn)

      Returns an aggregate operation that accumulates the items into a `HashMap` whose keys and values are the result of applying the provided mapping functions.

      This aggregate operation does not tolerate duplicate keys and will throw `IllegalStateException` if it detects them. If your data contains duplicates, use the `toMap()` overload that can resolve them.

      Type Parameters:
        `T` - input item type
        `K` - type of the key
        `U` - type of the value
      Parameters:
        `keyFn` - a function to extract the key from the input item
        `valueFn` - a function to extract the value from the input item
      See Also:
        `toMap(DistributedFunction, DistributedFunction, DistributedBinaryOperator)`, `toMap(DistributedFunction, DistributedFunction, DistributedBinaryOperator, DistributedSupplier)`

    - #### toMap

          public static <T,K,U> AggregateOperation1<T,Map<K,U>,Map<K,U>> toMap(DistributedFunction<? super T,? extends K> keyFn,
                                                                               DistributedFunction<? super T,? extends U> valueFn,
                                                                               DistributedBinaryOperator<U> mergeFn)

      Returns an aggregate operation that accumulates the items into a `HashMap` whose keys and values are the result of applying the provided mapping functions.

      This aggregate operation resolves duplicate keys by applying `mergeFn` to the conflicting values. `mergeFn` will act upon the values after `valueFn` has already been applied.

      Type Parameters:
        `T` - input item type
        `K` - the type of key
        `U` - the output type of the value mapping function
      Parameters:
        `keyFn` - a function to extract the key from input item
        `valueFn` - a function to extract value from input item
        `mergeFn` - a merge function, used to resolve collisions between values associated with the same key, as supplied to `Map.merge(Object, Object, java.util.function.BiFunction)`
      See Also:
        `toMap(DistributedFunction, DistributedFunction)`, `toMap(DistributedFunction, DistributedFunction, DistributedBinaryOperator, DistributedSupplier)`

    - #### toMap

          public static <T,K,U,M extends Map<K,U>> AggregateOperation1<T,M,M> toMap(DistributedFunction<? super T,? extends K> keyFn,
                                                                                    DistributedFunction<? super T,? extends U> valueFn,
                                                                                    DistributedBinaryOperator<U> mergeFn,
                                                                                    DistributedSupplier<M> createMapFn)

      Returns an `AggregateOperation1` that accumulates elements into a `Map` whose keys and values are the result of applying the provided mapping functions to the input elements.

      If the mapped keys contain duplicates (according to `Object.equals(Object)`), the value mapping function is applied to each equal element, and the results are merged using the provided merging function. The `Map` is created by a provided `createMapFn` function.

      Type Parameters:
        `T` - input item type
        `K` - the output type of the key mapping function
        `U` - the output type of the value mapping function
        `M` - the type of the resulting `Map`
      Parameters:
        `keyFn` - a function to extract the key from input item
        `valueFn` - a function to extract value from input item
        `mergeFn` - a merge function, used to resolve collisions between values associated with the same key, as supplied to `Map.merge(Object, Object, java.util.function.BiFunction)`
        `createMapFn` - a function which returns a new, empty `Map` into which the results will be inserted
      See Also:
        `toMap(DistributedFunction, DistributedFunction)`, `toMap(DistributedFunction, DistributedFunction, DistributedBinaryOperator)`

    - #### groupingBy

          public static <T,K> AggregateOperation1<T,Map<K,List<T>>,Map<K,List<T>>> groupingBy(DistributedFunction<? super T,? extends K> keyFn)

      Returns an `AggregateOperation1` that accumulates the items into a `HashMap` where the key is the result of applying `keyFn` and the value is a list of the items with that key.

      This operation achieves the effect of a cascaded group-by where the members of each group are further classified by a secondary key.

      Type Parameters:
        `T` - input item type
        `K` - the output type of the key mapping function
      Parameters:
        `keyFn` - a function to extract the key from input item
      See Also:
        `groupingBy(DistributedFunction, AggregateOperation1)`, `groupingBy(DistributedFunction, DistributedSupplier, AggregateOperation1)`

    - #### groupingBy

          public static <T,K,A,R> AggregateOperation1<T,Map<K,A>,Map<K,R>> groupingBy(DistributedFunction<? super T,? extends K> keyFn,
                                                                                      AggregateOperation1<? super T,A,R> downstream)

      Returns an `AggregateOperation1` that accumulates the items into a `HashMap` where the key is the result of applying `keyFn` and the value is the result of applying the downstream aggregate operation to the items with that key.

      This operation achieves the effect of a cascaded group-by where the members of each group are further classified by a secondary key.

      Type Parameters:
        `T` - input item type
        `K` - the output type of the key mapping function
        `R` - the type of the downstream aggregation result
        `A` - downstream aggregation's accumulator type
      Parameters:
        `keyFn` - a function to extract the key from input item
        `downstream` - the downstream aggregate operation
      See Also:
        `groupingBy(DistributedFunction)`, `groupingBy(DistributedFunction, DistributedSupplier, AggregateOperation1)`

    - #### groupingBy

          public static <T,K,R,A,M extends Map<K,R>> AggregateOperation1<T,Map<K,A>,M> groupingBy(DistributedFunction<? super T,? extends K> keyFn,
                                                                                                  DistributedSupplier<M> createMapFn,
                                                                                                  AggregateOperation1<? super T,A,R> downstream)

      Returns an `AggregateOperation1` that accumulates the items into a `Map` (as obtained from `createMapFn`) where the key is the result of applying `keyFn` and the value is the result of applying the downstream aggregate operation to the items with that key.

      This operation achieves the effect of a cascaded group-by where the members of each group are further classified by a secondary key.

      Type Parameters:
        `T` - input item type
        `K` - the output type of the key mapping function
        `R` - the type of the downstream aggregation result
        `A` - downstream aggregation's accumulator type
        `M` - output type of the resulting `Map`
      Parameters:
        `keyFn` - a function to extract the key from input item
        `createMapFn` - a function which returns a new, empty `Map` into which the results will be inserted
        `downstream` - the downstream aggregate operation
      See Also:
        `groupingBy(DistributedFunction)`, `groupingBy(DistributedFunction, AggregateOperation1)`

    - #### reducing

          @Nonnull
          public static <T,A> AggregateOperation1<T,MutableReference<A>,A> reducing(@Nonnull
                                                                                             A emptyAccValue,
                                                                                             @Nonnull
                                                                                             DistributedFunction<? super T,? extends A> toAccValueFn,
                                                                                             @Nonnull
                                                                                             DistributedBinaryOperator<A> combineAccValuesFn,
                                                                                             @Nullable
                                                                                             DistributedBinaryOperator<A> deductAccValueFn)

      A reducing operation maintains an accumulated value that starts out as `emptyAccValue` and is iteratively transformed by applying `combineAccValuesFn` to it and each stream item's accumulated value, as returned from `toAccValueFn`. `combineAccValuesFn` must be associative because it will also be used to combine partial results, as well as commutative because the encounter order of items is unspecified.

      The optional `deductAccValueFn` allows Jet to compute the sliding window in O(1) time. It must undo the effects of a previous `combineAccValuesFn` call:

               A accVal;  (has some pre-existing value)
               A itemAccVal = toAccValueFn.apply(item);
               A combined = combineAccValuesFn.apply(accVal, itemAccVal);
               A deducted = deductAccValueFn.apply(combined, itemAccVal);
               assert deducted.equals(accVal);

      Type Parameters:
        `T` - input item type
        `A` - type of the accumulated value
      Parameters:
        `emptyAccValue` - the reducing operation's emptyAccValue element
        `toAccValueFn` - transforms the stream item into its accumulated value
        `combineAccValuesFn` - combines two accumulated values into one
        `deductAccValueFn` - deducts the right-hand accumulated value from the left-hand one (optional)

    - #### pickAny

          @Nonnull
          public static <T> AggregateOperation1<T,MutableReference<T>,T> pickAny()

      Returns an aggregate operation whose result is an arbitrary item it observed, or `null` if it observed no items.

      The implementation of `StageWithWindow.distinct()` uses this operation and, if needed, you can use it directly for the same purpose. For example, in a stream of Person objects you can specify the last name as the key. The result will be a stream of Person objects, one for each distinct last name:

               Pipeline p = Pipeline.create();
               p.<Person>drawFrom(list("persons"))
                .groupingKey(Person::getLastName)
                .aggregate(pickAny())
                .drainTo(...);

    - #### sorting

          public static <T> AggregateOperation1<T,ArrayList<T>,List<T>> sorting(@Nonnull
                                                                                DistributedComparator<? super T> comparator)

      Returns an aggregate operation that accumulates all input items into an `ArrayList` and sorts it with the given comparator. Use `DistributedComparator.naturalOrder()` if you want to sort `Comparable` items by their natural order.
      Type Parameters:
        `T` - the type of input items
      Parameters:
        `comparator` - the comparator to use for sorting

    - #### allOf

          @Nonnull
          public static <T,A0,A1,R0,R1,R> AggregateOperation1<T,Tuple2<A0,A1>,R> allOf(@Nonnull
                                                                                                AggregateOperation1<? super T,A0,? extends R0> op0,
                                                                                                @Nonnull
                                                                                                AggregateOperation1<? super T,A1,? extends R1> op1,
                                                                                                @Nonnull
                                                                                                DistributedBiFunction<? super R0,? super R1,? extends R> exportFinishFn)

      Returns an aggregate operation that is a composite of two aggregate operations. It allows you to calculate multiple aggregations over the same items at once.
      Type Parameters:
        `T` - type of input items
        `A0` - 1st accumulator type
        `A1` - 2nd accumulator type
        `R0` - 1st result type
        `R1` - 2nd result type
        `R` - final result type
      Parameters:
        `op0` - 1st operation
        `op1` - 2nd operation
        `exportFinishFn` - function combining the two results into a single target instance
      Returns:
        the composite operation

    - #### allOf

          @Nonnull
          public static <T,A0,A1,R0,R1> AggregateOperation1<T,Tuple2<A0,A1>,Tuple2<R0,R1>> allOf(@Nonnull
                                                                                                          AggregateOperation1<? super T,A0,R0> op1,
                                                                                                          @Nonnull
                                                                                                          AggregateOperation1<? super T,A1,R1> op2)

      Convenience for `allOf(AggregateOperation1, AggregateOperation1, DistributedBiFunction)` with identity finish.

    - #### allOf

          @Nonnull
          public static <T,A0,A1,A2,R0,R1,R2,R> AggregateOperation1<T,Tuple3<A0,A1,A2>,R> allOf(@Nonnull
                                                                                                         AggregateOperation1<? super T,A0,? extends R0> op0,
                                                                                                         @Nonnull
                                                                                                         AggregateOperation1<? super T,A1,? extends R1> op1,
                                                                                                         @Nonnull
                                                                                                         AggregateOperation1<? super T,A2,? extends R2> op2,
                                                                                                         @Nonnull
                                                                                                         DistributedTriFunction<? super R0,? super R1,? super R2,? extends R> exportFinishFn)

      Returns an aggregate operation that is a composite of three aggregate operations. It allows you to calculate multiple aggregations over the same items at once.
      Type Parameters:
        `T` - type of input items
        `A0` - 1st accumulator type
        `A1` - 2nd accumulator type
        `A2` - 3rd accumulator type
        `R0` - 1st result type
        `R1` - 2nd result type
        `R2` - 3rd result type
        `R` - final result type
      Parameters:
        `op0` - 1st operation
        `op1` - 2nd operation
        `op2` - 3rd operation
        `exportFinishFn` - function combining the three results into a single target instance
      Returns:
        the composite operation

    - #### allOf

          @Nonnull
          public static <T,A0,A1,A2,R0,R1,R2> AggregateOperation1<T,Tuple3<A0,A1,A2>,Tuple3<R0,R1,R2>> allOf(@Nonnull
                                                                                                                      AggregateOperation1<? super T,A0,? extends R0> op0,
                                                                                                                      @Nonnull
                                                                                                                      AggregateOperation1<? super T,A1,? extends R1> op1,
                                                                                                                      @Nonnull
                                                                                                                      AggregateOperation1<? super T,A2,? extends R2> op2)

      Convenience for `allOf(AggregateOperation1, AggregateOperation1, AggregateOperation1, DistributedTriFunction)` with identity finisher.

    - #### allOfBuilder

          @Nonnull
          public static <T> AllOfAggregationBuilder<T> allOfBuilder()

      Returns a builder object that helps you create a composite of multiple aggregate operations. The resulting aggregate operation will perform all of the constituent operations at the same time and you can retrieve each result from the `ItemsByTag` object you'll get in the output.

      The builder object is primarily intended to build a composite of four or more aggregate operations. For up to three operations, prefer the explicit, more type-safe variants `allOf(op1, op2)` and `allOf(op1, op2, op3)`.

      Example that calculates the count and the sum of the items:

           AllOfAggregationBuilder<Long> builder = allOfBuilder();
           Tag<Long> tagSum = builder.add(summingLong(Long::longValue));
           Tag<Long> tagCount = builder.add(counting());
           AggregateOperation1<Long, ?, ItemsByTag> compositeAggrOp = builder.build();

      When you receive the resulting `ItemsByTag`, fetch the individual results using the tags as keys, for example:

           batchStage.aggregate(compositeAggrOp).map((ItemsByTag result) -> {
               Long sum = result.get(tagSum);
               Long count = result.get(tagCount);
               ...
           });

      Type Parameters:
        `T` - type of input items

    - #### aggregateOperation2

          public static <T0,A0,R0,T1,A1,R1,R> AggregateOperation2<T0,T1,Tuple2<A0,A1>,R> aggregateOperation2(@Nonnull
                                                                                                             AggregateOperation1<? super T0,A0,? extends R0> op0,
                                                                                                             @Nonnull
                                                                                                             AggregateOperation1<? super T1,A1,? extends R1> op1,
                                                                                                             @Nonnull
                                                                                                             DistributedBiFunction<? super R0,? super R1,? extends R> exportFinishFn)

      Returns an aggregate operation that is a composite of two independent aggregate operations, each one accepting its own input. You need this kind of operation for a two-way co-aggregating pipeline stage: `stage.aggregate2()`.

      This method is suitable when you can express your computation as two independent aggregate operations where you combine only their final results. If you need an operation that combines the two inputs in the accumulation phase, you can create an aggregate operation by specifying each primitive using the aggregate operation builder.

      Type Parameters:
        `T0` - type of items in the first stage
        `A0` - type of the first aggregate operation's accumulator
        `R0` - type of the first aggregate operation's result
        `T1` - type of items in the second stage
        `A1` - type of the second aggregate operation's accumulator
        `R1` - type of the second aggregate operation's result
        `R` - type of the result
      Parameters:
        `op0` - the aggregate operation that will receive the first stage's input
        `op1` - the aggregate operation that will receive the second stage's input
        `exportFinishFn` - the function that transforms the individual aggregate results into the overall result that the co-aggregating stage emits

    - #### aggregateOperation2

          public static <T0,T1,A0,A1,R0,R1> AggregateOperation2<T0,T1,Tuple2<A0,A1>,Tuple2<R0,R1>> aggregateOperation2(@Nonnull
                                                                                                                       AggregateOperation1<? super T0,A0,? extends R0> op0,
                                                                                                                       @Nonnull
                                                                                                                       AggregateOperation1<? super T1,A1,? extends R1> op1)

      Convenience for `aggregateOperation2(aggrOp0, aggrOp1, finishFn)` that outputs a `Tuple2(result0, result1)`.
      Type Parameters:
        `T0` - type of items in the first stage
        `A0` - type of the first aggregate operation's accumulator
        `R0` - type of the first aggregate operation's result
        `T1` - type of items in the second stage
        `A1` - type of the second aggregate operation's accumulator
        `R1` - type of the second aggregate operation's result
      Parameters:
        `op0` - the aggregate operation that will receive the first stage's input
        `op1` - the aggregate operation that will receive the second stage's input

    - #### aggregateOperation3

          public static <T0,T1,T2,A0,A1,A2,R0,R1,R2,R> AggregateOperation3<T0,T1,T2,Tuple3<A0,A1,A2>,R> aggregateOperation3(@Nonnull
                                                                                                                            AggregateOperation1<? super T0,A0,? extends R0> op0,
                                                                                                                            @Nonnull
                                                                                                                            AggregateOperation1<? super T1,A1,? extends R1> op1,
                                                                                                                            @Nonnull
                                                                                                                            AggregateOperation1<? super T2,A2,? extends R2> op2,
                                                                                                                            @Nonnull
                                                                                                                            DistributedTriFunction<? super R0,? super R1,? super R2,? extends R> exportFinishFn)

      Returns an aggregate operation that is a composite of three independent aggregate operations, each one accepting its own input. You need this kind of operation for a three-way co-aggregating pipeline stage: `stage.aggregate3()`.

      This method is suitable when you can express your computation as three independent aggregate operations where you combine only their final results. If you need an operation that combines the three inputs in the accumulation phase, you can create an aggregate operation by specifying each primitive using the aggregate operation builder.

      Type Parameters:
        `T0` - type of items in the first stage
        `A0` - type of the first aggregate operation's accumulator
        `R0` - type of the first aggregate operation's result
        `T1` - type of items in the second stage
        `A1` - type of the second aggregate operation's accumulator
        `R1` - type of the second aggregate operation's result
        `T2` - type of items in the third stage
        `A2` - type of the third aggregate operation's accumulator
        `R2` - type of the third aggregate operation's result
        `R` - type of the result
      Parameters:
        `op0` - the aggregate operation that will receive the first stage's input
        `op1` - the aggregate operation that will receive the second stage's input
        `op2` - the aggregate operation that will receive the third stage's input
        `exportFinishFn` - the function that transforms the individual aggregate results into the overall result that the co-aggregating stage emits

    - #### aggregateOperation3

          public static <T0,T1,T2,A0,A1,A2,R0,R1,R2> AggregateOperation3<T0,T1,T2,Tuple3<A0,A1,A2>,Tuple3<R0,R1,R2>> aggregateOperation3(@Nonnull
                                                                                                                                         AggregateOperation1<? super T0,A0,? extends R0> op0,
                                                                                                                                         @Nonnull
                                                                                                                                         AggregateOperation1<? super T1,A1,? extends R1> op1,
                                                                                                                                         @Nonnull
                                                                                                                                         AggregateOperation1<? super T2,A2,? extends R2> op2)

      Convenience for `aggregateOperation3(aggrOp0, aggrOp1, aggrOp2, finishFn)` that outputs a `Tuple3(result0, result1, result2)`.
      Type Parameters:
        `T0` - type of items in the first stage
        `A0` - type of the first aggregate operation's accumulator
        `R0` - type of the first aggregate operation's result
        `T1` - type of items in the second stage
        `A1` - type of the second aggregate operation's accumulator
        `R1` - type of the second aggregate operation's result
        `T2` - type of items in the third stage
        `A2` - type of the third aggregate operation's accumulator
        `R2` - type of the third aggregate operation's result
      Parameters:
        `op0` - the aggregate operation that will receive the first stage's input
        `op1` - the aggregate operation that will receive the second stage's input
        `op2` - the aggregate operation that will receive the third stage's input

    - #### coAggregateOperationBuilder

          @Nonnull
          public static CoAggregateOperationBuilder coAggregateOperationBuilder()

      Returns a builder object that offers a step-by-step fluent API to create an aggregate operation that accepts multiple inputs. You must supply this kind of operation to a co-aggregating pipeline stage. Most typically you'll need this builder if you're using the `StageWithWindow.aggregateBuilder()`. For two-way or three-way co-aggregation you can use `aggregateOperation2(com.hazelcast.jet.aggregate.AggregateOperation1<? super T0, A0, ? extends R0>, com.hazelcast.jet.aggregate.AggregateOperation1<? super T1, A1, ? extends R1>, com.hazelcast.jet.function.DistributedBiFunction<? super R0, ? super R1, ? extends R>)` and `aggregateOperation3(com.hazelcast.jet.aggregate.AggregateOperation1<? super T0, A0, ? extends R0>, com.hazelcast.jet.aggregate.AggregateOperation1<? super T1, A1, ? extends R1>, com.hazelcast.jet.aggregate.AggregateOperation1<? super T2, A2, ? extends R2>, com.hazelcast.jet.function.DistributedTriFunction<? super R0, ? super R1, ? super R2, ? extends R>)`.

      This builder is suitable when you can express your computation as independent aggregate operations on each input where you combine only their final results. If you need an operation that combines the inputs in the accumulation phase, you can create an aggregate operation by specifying each primitive using the aggregate operation builder.

Copyright © 2018. All rights reserved.