Package: groovy.transform

## [Java] Annotation Type Reducer

- groovy.transform.Reducer

-     @Documented
      @Incubating
      @Target(ElementType.METHOD)
      @Retention(RetentionPolicy.RUNTIME)
      public @interface Reducer

  Declares that a two-argument combining method is associative and has an identity element — together, the algebraic contract a seeded parallel reduction relies on. Equivalent to Associative plus a declared zero such that `combine(zero, a) == a == combine(a, zero)`.

  The zero() member names the identity element as a constant expression (for example `"0"`, `"''"`, or a fully-qualified static field reference). When supplied, tooling such as `groovy.typecheckers.CombinerChecker` can additionally check that the `seed` passed to `injectParallel` matches the declared identity where both are statically determinable. An empty value asserts associativity and the existence of an identity without naming it.

  As with Associative, this annotation asserts the laws; it does not prove them. The assertion is intended to be backed by tests.

  Since:
    6.0.0

- - ### Element Summary

    Optional Element Summary
    Type | Name and Description
    --- | ---
    `String` | `zero` The identity element, as a constant expression.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Element Detail

    - #### public String zero

      The identity element, as a constant expression. Empty means the identity exists but is not named (associativity is still asserted).

      Default:
        ""