remove method

void remove(
  1. T element, [
  2. int count = 1
])

Removes element from the multiset count times.

If count is not specified, removes the element once. If multiplicity becomes zero or negative, the element is removed entirely.

Implementation

void remove(T element, [int count = 1]) {
  if (_elements.containsKey(element)) {
    _elements[element] = (_elements[element] ?? 0) - count;
    if (_elements[element]! <= 0) _elements.remove(element);
  }
}