user2761431
user2761431

Reputation: 975

Get MutableList<MutableList<Int>> from List<List<Int>> in Kotlin

I have a List<List> and need to form a mutable list of lists out of it.

fun trial (check: List<List<Int>>): Int {
   val mutableCheck : MutableList<MutableList<Int>> = //mutableListOf(check)?
}

I tried various ways, but not able to make it work.

Upvotes: 0

Views: 336

Answers (1)

IR42
IR42

Reputation: 9722

val mutableCheck = check.map { it.toMutableList() }.toMutableList()

Upvotes: 2

Related Questions