Converting a Scala typed collection to Java with unlimited wildcard, etc. Collection <?>
Problem: It is necessary to implement an interface from a third-party Java library in Scala
...
Collection<?> getItemPropertyIds()
...
My solution is to use
...<here goes Iterable>.asInstanceOf[java.util.Collection[_]]
val props:Map[Object,Property] = ...
override def getItemPropertyIds()=props.keys.asInstanceOf[java.util.Collection[_]]
Is there a better solution? Maybe with Predef implied?
+3
2 answers