Skip to content

Instantly share code, notes, and snippets.

@takashima0411
Created August 8, 2014 02:20
Show Gist options
  • Save takashima0411/2ab98ef0155a9344d344 to your computer and use it in GitHub Desktop.
Save takashima0411/2ab98ef0155a9344d344 to your computer and use it in GitHub Desktop.
def sample(strOpt:Option[String]) = strOpt match {
case Some(str) if str == "hoge" => Some(str)
case _ => None
}
@takashima0411
Copy link
Author

def sample(strOpt:Option[String]) = strOpt.filter(_ == "hoge")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment