You can add element to arrayList using add() method in Kotlin. For example,
arrayList.add(10)
Above code will add element 10 to arrayList.
However, if you are using Array or List, then you can not add element. This is because Array and List are Immutable. If you want to add element, you will have to use MutableList.
Several workarounds:
toMutableList()
method. Then, add element into it.System.arraycopy()
method.