Kotlin – Most idiomatic way to convert a List to a MutableList

Consider using the toMutableList() function:

presenter.getContacts().toMutableList()

There are toMutableList() extensions for the stdlib types that one might want to convert to a mutable list: Collection<T>, Iterable<T>, Sequence<T>, CharSequence, Array<T> and primitive arrays.

Leave a Comment