I have an Array[Any]
from Java JPA containing (two in this case, but consider any a small number of) differently-typed things. I would like to represent these as tuples instead.
I have some quick and dirty conversion code, and wondered how it could be improved and perhaps made more generic.
val pair = query.getSingleOrNone // returns Option[Any] (actually a Java array)
pair collect { case array: Array[Any] =>
(array(0).asInstanceOf[MyClass1], array(1).asInstanceOf[MyClass2]) }