mapToSetWhere<R> method
Creates a Set with all elements of this Iterable that satisfy
the predicate test
and modified by toElement
.
The Set is modifiable if modifiable
is true.
Implementation
Set<R> mapToSetWhere<R>(
R Function(T e) toElement,
bool Function(T e) test, {
bool modifiable = false,
}) {
final set = <R>{};
for (final element in this) {
if (test(element)) set.add(toElement(element));
}
return modifiable ? set : set.toUnmodifiableSet();
}