retainWhere method

void retainWhere (bool test(V element))
override

See Set.retainWhere

Implementation

void retainWhere(bool test(V element)) {
  List<V> chosen = [];
  for (var target in this) {
    if (test(target)) {
      chosen.add(target);
    }
  }
  clear();
  addAll(chosen);
}