Alternatively you can just write:

```scala
val mediaTypes = acceptHeader(HeaderNames.ACCEPT).map(item => (item._2, MediaRange(item._2))) // (same as before)
mediaTypes.sorted.flatMap(_._2).reverse
```