What is concise way of deep-copying a 2D MutableList?

Viewed 612

The element already implemented deep copying.

fun <T : DeepCopiable> f(a: MutableList<MutableList<T>>) {
    val copied = a.map { it.map { it.deepCopy() }.toMutableList() }.toMutableList()
    ...
}

I am using this kind of code, but it seems verbose.

2 Answers
Related