retainWhere method

  1. @override
void retainWhere(
  1. bool test(
    1. V element
    )
)
override

Implementation

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