I have an empty array list:
var mylist: ArrayList<Int> = ArrayList()
When I want to set value in it I got this error:
java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
The question is: How can I initialize my list?
According to the api-doc:
val list = arrayListOf<Int>()
This is also mentioned here: How to initialize List in Kotlin? .