Scala - cllu/.rc GitHub Wiki

Stack

  • Build: sbt
  • Database: H2
  • ORM: sorm2
  • Testing: scalatest
  • Logging: slf4j + logback
  • Web: scalatra
  • json: json4s
  • yaml: snakeyaml
  • Http Request: scalaj-http

Code snippets

Map untuple:

val arrayOfTuples = List((1, "Two"), (3, "Four"))
arrayOfTuples map {case (e1: Int, e2: String) => e1.toString + e2}

Scalatest

To assert exception:

val s = "hi"
intercept[IndexOutOfBoundsException] {
  s.charAt(-1)
}