Array<Int>
is an Integer[]
under the hood, while IntArray
is an int[]
.
This means that when you put an Int
in an Array<Int>
, it will always be boxed (specifically, with an Integer.valueOf()
call). In the case of IntArray
, no boxing will occur, because it translates to a Java primitive array.
So no, we can’t use them interchangeably.