filter method

  1. @useResult
KtMap<K, V> filter(
  1. bool predicate(
    1. KtMapEntry<K, V> entry
    )
)

Returns a new map containing all key-value pairs matching the given predicate.

The returned map preserves the entry iteration order of the original map.

Implementation

@useResult
KtMap<K, V> filter(bool Function(KtMapEntry<K, V> entry) predicate) {
  final filtered = filterTo(linkedMapFrom<K, V>(), predicate);
  // TODO ping dart-lang/sdk team to check type bug
  return filtered;
}