If A is a TypeTag the following condition will try to match the inner types of Tuple2 too, i.e String and Int.
if (typeOf[A] == typeOf[Int])
...
else if (typeOf[A] == typeOf[Tuple2[String, Int]])
...
If A is a ClassTag the following condition will match up to Tuple2 but not the inner types.
if (classTag[A] == classTag[Int])
...
else if (classTag[A] == classTag[Tuple2[String, Int]])
...
Is there a way to match the inner types of a tuple using ClassTag?
Aucun commentaire:
Enregistrer un commentaire