Last active
December 28, 2015 21:39
-
-
Save jakob85/7566290 to your computer and use it in GitHub Desktop.
Scala stuff!
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
/** 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