Spec-Zone.ru › Dart 1

dart:collection

свойство single

Единственный

Проверяет, что этот итерируемый объект содержит только один элемент, и возвращает этот элемент.

Выбрасывает StateError если this пуста или содержит более одного элемента.

Исходный код

E get single {
  // Note that this throws correctly if the queue is empty
  // because reading the element of the sentinel throws.
  if (identical(_sentinel._nextLink, _sentinel._previousLink)) {
    _DoubleLinkedQueueEntry<E> entry = _sentinel._nextLink;
    return entry._element;
  }
  throw IterableElementError.tooMany();
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-collection/DoubleLinkedQueue/single.html

Spec-Zone.ru

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