Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. val t1 = Try("hello")
  2. val t2 = Try(throw new Exception("let's fail instead"))
  3. val t3 = Try("world")
  4. val t4 = t1.flatMap(a => t2.flatMap(b => t3.map(c => a + " " + c)))
  5. // t4: scala.util.Try[String] = Failure(java.lang.Exception: let's fail instead)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement