SplayTreeSet<E>.of constructor
Creates a SplayTreeSet from elements
.
The set works as if created by new SplayTreeSet<E>(compare, isValidKey)
.
All the elements
should be valid as arguments to the compare
function.
Example:
final baseSet = <int>{1, 2, 3};
final setOf = SplayTreeSet<num>.of(baseSet);
print(setOf); // {1, 2, 3}
Implementation
factory SplayTreeSet.of(
Iterable<E> elements, [
int Function(E key1, E key2)? compare,
bool Function(dynamic potentialKey)? isValidKey,
]) => SplayTreeSet(compare, isValidKey)..addAll(elements);