Spec-Zone.ru › Dart 1

dart:html

Метод retainWhere

void retainWhere(bool test(E element))

Удаляет все объекты из этого списка, которые не удовлетворяют test.

Объект o удовлетворяет test если test(o) равно true.

List<String> numbers = ['one', 'two', 'three', 'four'];
numbers.retainWhere((item) => item.length == 3);
numbers.join(', '); // 'one, two'

Выбрасывает UnsupportedError если это список с фиксированной длиной.

Исходный код

void retainWhere(bool test(E element)) {
  throw new UnsupportedError("Cannot remove from immutable List.");
}

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

Spec-Zone.ru

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