toMutableList() is used to copy one List to the other. It creates a Mutable/changeable copy of the existing List.
fun main() { val x = mutableListOf("Mohan", "Kriti", "Salim") var y = x.toMutableList() println("The Copied List is "+y) }
So, in the above code we have created a 'List' and initialised to the variable 'x'.
Below is how the values are positioned in the List,
Then we have used the 'toList()' method and create a new List that would be the exact copy of 'x'.
Then assign it to 'y'.
And we get the below output,