I have a map that’s of type `VertxHttpHeaders`. Th...
# getting-started
s
I have a map that’s of type
VertxHttpHeaders
. That’s a type that implements
Iterable<Map.Entry<String, String>>
but it does not implement
Map
. I want to filter out some headers and get back a Map. This is what I’ve come up with:
Copy code
headers
    .map { it.toPair() }
    .toMap()
    .filterKeys { noCopyHeaders.contains(it).not() }
Can I do better somehow? 🙂 I wish I didn’t have to do the two-step conversion to the map and I wish I had a `filterNotKeys`… I guess I could just add those as extensions
d
Copy code
headers.associate { it.toPair() }
    .filterKeys { noCopyHeaders.contains(it).not() }
s
Oh, nice!