...
Built-in Scala libraries often make heavy use of the Option type. See section about HashMap below.
Avoid match-case with Pattern Matching
Scala's very nice match-case, and case classes uses Option types underneath in the matching.
Instead of this:
Code Block |
---|
foo match {
case Foo(a, b) => ....
... |
Write this instead:
Code Block |
---|
foo match {
case f: Foo => { val a = f.a ; val b = f.b ; ....
... |
This doesn't allocate in execution.
Avoid scala.collections.HashMap. Use Java HashMap Instead
...