Last active
December 19, 2015 22:49
Revisions
-
Mark Mazumder revised this gist
Jul 18, 2013 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,9 @@ Option -> Optional ------------------ one-liner to make a Guava Optional from a scala Option (keep in mind that Guava Optionals are not monadic) Todo ---- Implicit conversion example -
Mark Mazumder revised this gist
Jul 18, 2013 . 3 changed files with 15 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ name := "ScalaOptionToGuavaOptional" scalaVersion := "2.10.2" libraryDependencies += "com.google.guava" % "guava" % "14.0.1" libraryDependencies += "com.google.code.findbugs" % "jsr305" % "2.0.1" 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +0,0 @@ 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ import com.google.common.base.Optional def toOptional[T >: Null](x : Option[T]) : Optional[T] = Optional.fromNullable[T](x.orNull[T]) //examples toOptional(None) toOptional(Some("dude")) toOptional(Some(3)) -
Mark Mazumder revised this gist
Jul 18, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ import com.google.common.base.Optional def toOptional[T](x : Option[T]) : Optional[T] = Optional.fromNullable[T](x.orNull[T]) //examples toOptional(None) -
Mark Mazumder revised this gist
Jul 18, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ Option -> Optional ------------------ one-liner to make a Guava Optional from a scala Option (keep in mind that Guava Optionals are not monadic) -
Mark Mazumder revised this gist
Jul 18, 2013 . 2 changed files with 4 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ Option -> Optional ================== one-liner to make a Guava Optional from a scala Option (keep in mind that Guava Optionals are not monadic) -
Mark Mazumder created this gist
Jul 18, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ import com.google.common.base.Optional def toOptional[T](sop : Option[T]) : Optional[T] = Optional.fromNullable[T](sop.orNull[T]) //examples toOptional(None) toOptional(Some("dude"))