Arrays (T[]
)
Arrays of items are represented with the most common, and most efficient array datastructures in native languages, such as std::vector<T>
or Array<T>
.
- TypeScript
- C++
- Swift
- Kotlin
interface Contacts extends HybridObject {
getAllUsers(): User[]
}
class HybridContacts : public HybridContactsSpec {
std::vector<User> getAllUsers();
}
class HybridContacts: HybridContactsSpec {
fun getAllUsers() -> Array<User>
}
class HybridContacts: HybridContactsSpec() {
fun getAllUsers(): Array<User>
}
Kotlin PrimitiveArray
As a performance improvement, the JNI (C++ -> Kotlin interface) provides Primitive Array datatypes which can avoid boxing primitives into Object
s, and provides bulk copy methods.
This makes all array operations a lot faster, and Nitrogen is smart enough to ✨automagically✨ use Primitive Arrays whenever possible.
This will replace the following arrays:
Array<Double>
->DoubleArray
Array<Boolean>
->BooleanArray
Array<Long>
->LongArray