I'm working on a java lib in scala.
I got something like this:
def myFunc(): Thing[Iterable[T]] = {
// call java lib for the result
...
javaResult // Problem: it's Thing[java.lang.Iterable[T]]
}
So you see the problem is that the return type of the java thing is Thing[java.lang.Iterable[T]]
. I've tried importing scala.collection.JavaConverters._
but that doesn't work. Note that I don't have access to the java lib and I'm not able to extract that iterable then reconstruct a Thing object with a scala one.
I can annotate the return type as java.lang.Iterable
but as scala and java are designed to be work together, I'm wondering if there's some way to solve this problem elegantly?