Posts Tagged ‘Nugget’
Scala Nugget – Pattern matching and Lists
I was whining recently about how my scala-code is java in poor disguise. I started reading the scala by example pdf that also comes with the scala installation. I just read some interesting things about lists and pattern-matching that gave me an idea how to “scalafy” the following scjava-code:
Scala Nugget – implicits to make java blend into Scala
Most of my posts related to Scala so far have been quite long and unpolished I have intentionally kept them that way since I wanted to give a feel for what i is really like to make the shift, including the dead ends.
During the work of converting Java to Scala I have stumbled over some things that I found to be extra cool, nuggets. I’ll try to post them here from time to time.
The first nugget is about implicits. Implicits are so cool that I think I will shoot myself in the foot with them many times so let’s start now. One piece of java-code that I converted looked for module descriptions on the class-path. The code looked something like this:

Stumble It!