From
val array = intArrayOf(5, 3, 0, 2, 4, 1, 0, 5, 2, 3, 1, 4)
I need to convert to ArrayList<Int>
I have tried array.toTypedArray()
But it converted to Array<Int>
instead
You can use toCollection
function and specify ArrayList
as a mutable collection to fill:
val arrayList = intArrayOf(1, 2, 5).toCollection(ArrayList())