I wonder if there is any way to optimize the following Scala code because it doesn't look very efficient.
Basically, I just want to remove any object which is not a Tweet
from the flow and map it to Tweet
instead of Any
.
val tweetsFlow = Flow[Any].filter({
case _: Tweet => true
case _ => false
}).map({
case tweet: Tweet => tweet
})