Skip to content

Instantly share code, notes, and snippets.

@jakob85
Last active December 28, 2015 21:39
Show Gist options
  • Save jakob85/7566290 to your computer and use it in GitHub Desktop.
Save jakob85/7566290 to your computer and use it in GitHub Desktop.
Scala stuff!
/** list to commaseparated string */
val test = firstRow match {
case xs if xs.size == 0 || xs.size == 1 => xs.mkString
case xs if xs.size > 1 => xs.mkString(", ")
}
/** commaseparated string to distinct array */
.split(",").flatMap(maybeInt =>
scala.util.Try(maybeInt.toInt).toOption).distinct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment