Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


However, see below about MStack and generic collections.

Built-in Scala libraries often make heavy use of the Option type. See section about HashMap below.

Avoid scala.collections.HashMap. Use Java HashMap Instead

This is a library instance of the "avoid Option type" problem.

Scala's mutable HashMap allocates a Some\[T] object for every successful get(key) call.

This is unacceptable overhead for something done so frequently. Use Java's HashMap instead, where get(key) returns a value or null, and never allocates anything.

Avoid Generic Collections of Unboxed Types