Kotlin: LinkedList Implementation

Viewed 4122

Why does Kotlin not have a LinkedList implementation in the Kotlin Standard Library (stdlib)?

If I'm working with Kotlin in the JVM I'm using the Java LinkedList source.

Is there an equivalent in the stdlib (in particular regarding Kotlin Native Development)?

1 Answers

Kotlin does not have its own collections because it would be too difficult to maintain Java interoperability. Instead, the Kotlin Standard Library just adds some extension functions to the Java collections to make them easier to work with.

To quote Kotlin in Action:

Why are there no Kotlin collections? Because using the standard Java collections makes it much easier to interact with Java code. You don’t need to convert collections one way or the other when you call Java functions from Kotlin or vice versa.

Related