Created
October 7, 2011 20:23
-
-
Save gclaramunt/1271271 to your computer and use it in GitHub Desktop.
Safely call Java from Scala
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
def unsafeCall[T](x: =>T):Option[T]= try { | |
Option(x) | |
} catch { | |
case _ => None | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment