code: @Override
    public UnionWeight<W> times(UnionWeight<W> a, UnionWeight<W> b) {
      if (isZero(a) || isZero(b)) {
        return zero();
      }
      UnionWeight<W> result = zero();
      for (int i = 0; i < a.size(); i++) {
        UnionWeight<W> row = zero(); // empty set
        for (int j = 0; j < b.size(); j++) {
          row = withAppended(row, this.weightSemiring.times(a.get(i), b.get(j)));
        }
        result = this.plus(result, row);
      }
      return result;
    }
docs: Times multiplies all of A by all of B; it is commutative if the underlying semiring Times is commutative
  (which is not the case if the underlying is Gallic)
  @param a
  @param b
  @return