Spec-Zone.ru › Dart 2

dart:collection

Конструктор SplayTreeSet<E>.of

SplayTreeSet<E>.of(
  1. Iterable<E> elements,
  2. [int compare(
    1. E key1,
    2. E key2
    )?,
  3. bool isValidKey(
    1. dynamic potentialKey
    )?]
)

Создаёт SplayTreeSet из elements.

Множество работает так, как если бы оно было создано new SplayTreeSet<E>(compare, isValidKey).

Все elements должны быть допустимыми аргументами для функции compare. Пример:

final baseSet = <int>{1, 2, 3};
final setOf = SplayTreeSet<num>.of(baseSet);
print(setOf); // {1, 2, 3}

Реализация

factory SplayTreeSet.of(Iterable<E> elements,
        [int Function(E key1, E key2)? compare,
        bool Function(dynamic potentialKey)? isValidKey]) =>
    SplayTreeSet(compare, isValidKey)..addAll(elements);

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

Spec-Zone.ru

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