code: @CanIgnoreReturnValue
    @Override
    public int setCount(E element, int count) {
      checkIsE(element);
      checkNonnegative(count, "count");
      int index = element.ordinal();
      int oldCount = counts[index];
      counts[index] = count;
      size += count - oldCount;
      if (oldCount == 0 && count > 0) {
        distinctElements++;
      } else if (oldCount > 0 && count == 0) {
        distinctElements--;
      }
      return oldCount;
    }
docs: Modification Operations