Created
June 13, 2016 16:12
-
-
Save tkfx/8ce765cb017a2d4357dbbdc8563b891a to your computer and use it in GitHub Desktop.
Scala Future
This file contains 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