简体   繁体   中英

passing Kotlin Tuple to a Java function

I have a Kotlin function which returns a map like Map<String, Pair<String, String>> . I need to pass it to a java function and java does not seem to have a Pair data structure. What would be the best way to pass such a structure to the Java function?

You can just use Pair ( import kotlin.Pair; ), since that is compiled to a JVM class, this isn't any different from using any other kotlin class in java.

https://kotlinlang.org/docs/java-to-kotlin-interop.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM