Spec-Zone.ru › Dart 2

dart:collection

Метод operator []=

void operator []=(
  1. K key,
  2. V value
)
override

Связывает key с заданным value.

Если ключ уже присутствовал в карте, его связанное значение изменяется. В противном случае пара ключ/значение добавляется в карту.

Реализация

void operator []=(K key, V value) {
  // Splay on the key to move the last node on the search path for
  // the key to the root of the tree.
  int comp = _splay(key);
  if (comp == 0) {
    _root = _root!._replaceValue(value);
    // To represent structure change, in case someone caches the old node.
    _splayCount += 1;
    return;
  }
  _addNewRoot(_SplayTreeMapNode(key, value), comp);
}

© 2012 the Dart project authors
Licensed under the BSD 3-Clause "New" or "Revised" License.
https://api.dart.dev/stable/2.18.5/dart-collection/SplayTreeMap/operator_put.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API