Home > database >  Why does Kotlin documentation for ArrayList mention JavaScript?
Why does Kotlin documentation for ArrayList mention JavaScript?

Time:11-21

In the documentation for ArrayList it says:

Provides a MutableList implementation, which uses a resizable array as its backing storage.

This implementation doesn't provide a way to manage capacity, as backing JS array is resizeable itself. There is no speed advantage to pre-allocating array sizes in JavaScript, so this implementation does not include any of the capacity and "growth increment" concepts.

Link here: enter image description here

You'll notice there's an orange dot next to the documentation for the ArrayList class you mentioned. That is because this ArrayList class is only in the JavaScript standard library. On JVM, there's only a typealias to the JVM implementation of ArrayList, so there's a green dot next to that.

CodePudding user response:

Kotlin can currently be compiled to JVM byte code, JS, and native machine code. The website shows details for all three targets. The part you are quoting is exclusively about the JS target.

  • Related