Kotlin & Coroutines (50 Qs)•Part 3: K2 Compiler, KMP, Advanced Metaprogramming & Optimization (25 - 35)
What is the difference between Array<T> and primitive arrays like IntArray in Kotlin?
senior LevelPerformanceData Structures
In Simple Words:
Array<Int>: Maps to Java'sInteger[]reference array on the JVM, incurring boxing overhead for every element.IntArray/ByteArray: Maps directly to native primitive Javaint[]on the JVM, storing values unboxed in contiguous memory with zero allocation overhead.