Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[writing-async-app-in-scala-part-3] multiple transformations
def rpcCall: Future[String] = ???
rpcCall
.map(_.split('_'))
.filter(_.length < 4)
.map {
case Array(single) => single
case Array(first, second@_) => first
case Array(first@_, second, third@_) => third
case _ => ""
}
.map(value => s"<p>$value</p>")
.recoverFilter("<p>invalid</p>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment