Having a list of Data
val list: List<Data>
And want to make a shallow copy of it into a new list.
There are a few ways could do it in kotlin, wondering which one should be used in which case?
list?.filter is similar to mutableListOf, but listOf seems different.
Anyone suggestion?
val copyData = list?.filter{true}
copyData = mutableListOf(list)
copyData = listOf(list)