In using a framework like FastUtils with Scala, how do you generate the appropriate code based on the effective specialization as the framework itself has specialised data structures? I.e., how you you programmatically figure out what is being specialized and execute the appropriate code? So how do you deal with path related typing in such cases.
For objects
class Container[@specialized T](var window: Int) {
val data = new ObjectArrayList[T](window)
}
For char
I want it to be:
class Container[@specialized T](var window: Int) {
val data = new CharArrayList(window)
}
But this should be based on the specialization of T
. If I am to put this differently the sudo code would be perhaps like
class Container[@specialized T](var window: Int) {
val data = specialisationOf(T) match {
case "Char" => new CharArrayList(window)
case "Int" => new IntegerArrayList(window)
...
...
...
case _ => new ObjectArrayList[T](window)
}
}