I have a method like this:
def aMethod(param: String = \"asdf\") = {
...
}
If the method is called as follows, then param is given the
def aMethod(param: String = null) {
val paramOrDefault = param match {
case null => "asdf"
case s => s
}
}
def aMethod(param: String = null) {
val paramOrDefault = Option(param).getOrElse("asdf")
}
def aMethod(param: Option[String] = None) {
val paramOrDefault = param getOrElse "asdf"
}
The last approach is actually the most idiomatic and readable once you get use to it.