partition method
Splits this map into two maps based on predicate.
First map: entries where predicate is true.
Second map: entries where predicate is false.
Implementation
Pair<Map<K, V>, Map<K, V>> partition(
bool Function(K key, V value) predicate,
) {
final yes = <K, V>{}, no = <K, V>{};
for (final e in entries) {
(predicate(e.key, e.value) ? yes : no)[e.key] = e.value;
}
return Pair(yes, no);
}