I have a problem with generics in Scala. I have two classes
import scala.reflect.ClassTag
class Data[T: ClassTag](val list: List[T]) {
}
trait Transformation {
def transform[T, U](data: Data[T]) : Data[U]
}
Now I want to implement a class to pass from Int to String, something like this
class FromInt2String extends Transformation {
override def transform[String, Int](data: Data[String]) = ???
}
But I know this is exactly like
class FromInt2String extends Transformation {
override def transform[T, U](data: Data[T]) = ???
}
How can I do this without adding type parameters in the Transformation?
Thanks