-
-
Save mishin/f51e9f16312685274346fa6d1f3bc799 to your computer and use it in GitHub Desktop.
Scala Future
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.util.{Success, Failure} | |
val f: Future[List[String]] = Future { | |
session.getRecentPosts | |
} | |
f onComplete { | |
case Success(posts) => for (post <- posts) println(post) | |
case Failure(t) => println("An error has occured: " + t.getMessage) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment