I've already look at similar questions on this topic and their answers, but I'm still not satisfied.
In this posted answer, it says that IntArray corresponds int[] in Java, and it goes on to say Array<T> corresponds to T[].
My question is, what does int[][] correspond to? Is the answer Array<IntArray> like this other posted answer says? Because that just sounds like it has way more overhead than the primitive and nice looking int[][].
Are they the exact same thing? If not, how are they different? And most importantly, how can I express Java's int[][] in Kotlin?
Interoperability is sadly not an option as it cannot find the Java class during runtime.
In case it matters, here's the piece of code:
Array<IntArray>is the same asint[][]. What do you mean by saying it adds overhead?Array<IntArray>looks a lot more high-level thanint[][]and it looks like there are more abstractions and levels of indirection involved, all of which translate to more overhead.Array<Int>isInteger[],IntArrayisint[]andArray<IntArray>isint[][]. Kotlin authors attempted to hide the type complexity of underlying Java, but this is not entirely possible without sacrificing the access to its low-level types.Integer[][]?