Spec-Zone.ru › Dart 2

dart:collection

Метод lastKeyBefore

K? lastKeyBefore(
  1. K key
)

Последний ключ в словаре, строго меньший, чем key.

Возвращает null, если ключ не найден.

Реализация

K? lastKeyBefore(K key) {
  if (key == null) throw ArgumentError(key);
  if (_root == null) return null;
  int comp = _splay(key);
  if (comp < 0) return _root!.key;
  _SplayTreeMapNode<K, V>? node = _root!._left;
  if (node == null) return null;
  var nodeRight = node._right;
  while (nodeRight != null) {
    node = nodeRight;
    nodeRight = node._right;
  }
  return node!.key;
}

© 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/lastKeyBefore.html

Spec-Zone.ru

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