This doesn't allocate in execution.
Map. Use NonAllocatingMap (wraps Java
This is a library instance of the "avoid Option type" problem.
Scala's maps, including mutable HashMap allocates , allocate a Some[T] object for every successful get(key) call.
This is unacceptable overhead for something done so frequently. Use
It is better to use Java's HashMap java.util.Map classes instead, where get(key) returns a value or null, and never allocates anything.
To make this convenient, there is a wrapper NonAllocatingMap:
import edu.illinois.ncsa.daffodil.util.NonAllocatingMap val myMap = new NonAllocatingMap[String, String](new java.util.HashMap[String, String])
This provides the map functionality of the java-provided map class, recast as Scala's types.
Avoid Generic Collections of Unboxed Types