kotlin convert array to arrayList

To convert an array to an ArrayList in Kotlin, follow these steps:

  1. Create an array.
  2. Use the toList() function to convert the array to a list.
  3. Use the ArrayList constructor to create an ArrayList from the list.

Here's an example:

val array = arrayOf(1, 2, 3, 4, 5)
val list = array.toList()
val arrayList = ArrayList(list)