insert method

void insert(
  1. K key,
  2. V value
)

Inserts a new key-value pair into the map. Time complexity: O(log N).

Implementation

void insert(K key, V value) {
  if (!_container.containsKey(key)) {
    _container[key] = [];
  }
  _container[key]!.add(value);
  _size++;
}