Kotlin collections are based on Java collections, ...
# kotlin-native
d
Kotlin collections are based on Java collections, according to the documentation. What does this mean for collections in Kotlin/Native? Are the simply 'not available'? And if yes, what is the future plan for this?
t
easy answer. Kotlin collections are not based on Java collections.
d
Oh wow. I was sure that I read this somewhere. But I have been skimming through the documentation for a few minutes now, and I am unable to find this claim. So either this was changed somewhat recently, or I was hallucinating. xD Anyhow, great to hear!
s
Kotlin collections may be based on Java collections in terms of design, and they are based on Java collections when it comes to implementation on the JVM, but the implementation on other platforms is custom.
👍 2
API is common and loosely based on Java, implementation on JVM defers to Java standard library, and implementation elsewhere is custom, to put it simply
👍 2
t
Implementation of collections on the JVM does not defer to JVM collections. It’s based on the same source code as used on Native. You can easily see for yourself, just jump to the source code. There are mappings to platform types of the JVM (e.g. so a Java Iterator also works as a Kotlin Iterator), but there are also such mappings e.g. for ObjectiveC/Swift
👍🏿 2