multiplicity method

int multiplicity(
  1. T element
)

Returns the multiplicity of element in this multiset.

Multiplicity is the number of times an element appears. Returns 0 if the element is not present.

Example:

final ms = MultiSet<int>.fromIterable([1, 1, 2, 2, 2, 3]);
print(ms.multiplicity(2)); // Output: 3

Implementation

int multiplicity(T element) => _elements[element] ?? 0;