is there a better way to write the code below?
val t = map.get(\'type).getOrElse(\"\"); if (t != \"\") \"prefix\" + t;
be interested in inline
It's also worth noting that, in certain cases, you can replace multiple common .getOrElse usages with one .withDefaultValue call.
.getOrElse
.withDefaultValue
val map = complexMapCalculation().withDefaultValue("") val t = map('type)
I wouldn't say this is something that should be done every time, but it can be handy.