I need to call some Java library code that returns untyped java.util.List, and I cannot convert it to a Scala 2.8 list without compiling the compiler with the following error:
[INFO] found : java.util.List[?0] where type ?0 [INFO] required: java.util.List[AnyRef] [INFO] val modules: Buffer[AnyRef] = asScalaBuffer(feedEntry.getModules)
I tried as usual
import scala.collection.JavaConversions._ val modules: Buffer[AnyRef] = feedEntry.getModules
as explicit
val modules: Buffer[AnyRef] = asScalaBuffer(feedEntry.getModules)
I know the type of the items in the list, and I tried to set this as the buffer type, but I still get the same error.
I looked around, but all the documentation suggests that the Java list will be printed. How to convert untyped lists?
Age mooij
source share