It could not sensibly be implemented. Every `Map` ...
# announcements
d
It could not sensibly be implemented. Every
Map
implementation would have to implement
filter
.
a
Something like
Copy code
inline fun T.filter<reified T : Map<X>>() {
  when (this) {
    is HashMap -> HashMap(result)
  }
}
Wouldn’t work for custom types yeah
d
And it's also extremely ugly if you can just do
map.filterTo(HashMap()) {  }
.
a
yep, I agree, just saying 🙂 I like that it returns
Map
tbh
less code relies on implementation
d
Yep, which is good.
đź‘Ť 1