Created
February 22, 2017 13:59
-
-
Save gustavofranke/9bebdf129facf5bdc7b363345e7b3b18 to your computer and use it in GitHub Desktop.
scala try type
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.Try | |
val a = Try(5 / 0) | |
a.isSuccess | |
a.isFailure | |
a.toOption | |
a.failed | |
a.orElse(Try(1)) | |
a.recoverWith { case _ ⇒ Try(1) } | |
a.getOrElse("boom") | |
a.get |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment