Hey. Anybody can help me with java interoperabilit...
# getting-started
j
Hey. Anybody can help me with java interoperability? I want to call a method with a wildcard list from java Kotlin method I want to call:
Copy code
class DaClass {
  companion object {
    @JvmStatic
    fun convert(strings: Iterable<String>): List<Int> {
      return strings.map { convert(it) }
    }

    @JvmStatic
    fun convert(string: String): Int {
      return java.lang.Integer.parseInt(string)
    }
  }
}
Java-Call:
Copy code
List<String> list = ImmutableList.of("1", "2");
    System.out.println(DaClass.convert(list));

    List<? extends String> listWithWildcards = ImmutableList.of("1", "2");
    System.out.println(DaClass.convert(listWithWildcards)); //Does *not* compile
Ok. Found it:
fun convert(strings: Iterable<@JvmWildcard String>): List<Int> {
t
Did you try to use Iterable<out String> ?
j
The type for Iterable is already defined as "out"