I need to filter a sequence to remove an element that matches a certain case.
This seems too clumsy:
val filtered =
headers.filterNot{ case Authorization(_) => true; case _ => false }
Is there a more concise/idiomatic way?
You can use isInstanceOf
, like this
headers.filterNot(_.isInstanceOf[Authorization])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With