put method

V? put(
  1. K key,
  2. V value
)

Implementation

V? put(K key, V value) {
  assert(key != null && value != null);
  V? previous;
  _size += _safeSizeOf(key, value);
  if (_map.containsKey(key)) {
    previous = _map[key];
    _size -= _safeSizeOf(key, previous);
  }
  _map[key] = value;

  trimToSize(_maxSize);
  return previous;
}