How to clone or copy a list in kotlin

Audi picture Audi · Oct 20, 2017 · Viewed 65k times · Source

How to copy list in Kotlin?

I'm using

val selectedSeries = mutableListOf<String>()
selectedSeries.addAll(series)

Is there a easier way?

Answer

Audi picture Audi · Oct 20, 2017

This works fine.

val selectedSeries = series.toMutableList()