Конструктор фабрики SplayTreeSet.from
SplayTreeSet.from(Создает SplayTreeSet, который содержит все elements.
Множество работает так, как если бы оно было создано new SplayTreeSet<E>(compare, isValidKey).
Все elements должны быть допустимыми аргументами для функции compare.
Исходный код
factory SplayTreeSet.from(Iterable elements,
[int compare(E key1, E key2), bool isValidKey(potentialKey)]) {
SplayTreeSet<E> result = new SplayTreeSet<E>(compare, isValidKey);
for (final element in elements) {
E e = element as Object/*=E*/;
result.add(e);
}
return result;
}
© 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/SplayTreeSet/SplayTreeSet.from.html