MultiSet<T>.from constructor

MultiSet<T>.from(
  1. Iterable<T> elements, [
  2. int compare(
    1. T,
    2. T
    )?
])

Creates a MultiSet containing the elements of the given iterable.

Implementation

MultiSet.from(Iterable<T> elements, [int Function(T, T)? compare])
    : _container = collection.SplayTreeMap<T, int>(compare) {
  for (var element in elements) {
    insert(element);
  }
}