Posted in June 2012

New ScalaTest with IntelliJ IDEA

For existing code one can easily create a ScalaTest with Cmd+Shift+T. But for starting with the test the Scala plugin provides no template. I created following template for myself based on the Scala Class template: #if ((${PACKAGE_NAME} && ${PACKAGE_NAME} != “”))package ${PACKAGE_NAME} #end #parse(“File Header.java”) import org.scalatest.FunSuite class ${NAME}Suite extends FunSuite { }

Using minBy and maxBy of Scala Collections API

The Scaladoc of minBy and maxBy which were added in Scala 2.9 is quite rudimentary: def minBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A def maxBy[B](f: (A) ⇒ B)(implicit cmp: Ordering[B]): A I tried to understand these higher order functions and come up with a use case which makes sense: scala> case class Person(name: String, age: Int) defined class … Continue reading

Scala for the Intrigued

I just gathered the links of all installments of the excellent »Scala for the Intrigued Series« in Pragprog Magazine by Venkat Subramaniam: The Elegance of Scala Sensible Typing and Optional Items Cute Classes and Pure OO Functional Style of Programming Working with Collections Creating Higher Order Functions Pattern Matching XML as First Class Citizen Recursions and Tail … Continue reading