combineN method

  1. @override
T combineN(
  1. T a,
  2. int n
)
override

Return a, since combine(a, a) == a for a semilattice (idempotent).

Return empty if n == 0.

Implementation

@override
T combineN(T a, int n) {
  if (n < 0) {
    throw const FormatException(
        "Repeated combining for monoids must have n >= 0");
  } else if (n == 0) {
    return empty;
  }

  return a;
}