kotlin add element to list code example
Example 1: kotlin add element to array
val list: MutableList<String> = ArrayList()
list.add(3, "Hello")
// Adds Hello as the third item in list
list.add("Goodbye")
// Adds Goodbye to the end of list
Example 2: kotlin list add
// Use mutable list
var mutableList1 = mutableListOf("Garlic","Oignon")
mutableList1.add("Bean")