Home>

I want to define a new emptymutabelistfor the first call to recursion (mogemoge.hogehoge).

val lists = mutableListOf<String>()
// Is it impossible to write the following?
// val lists = mutableListOf<String>? ()


However, I want to keep the value that has entered themutablelistduring recursion while it is repeated in recursion.
Therefore, I want to pass a list that holds values ​​as an argument instead of initializing it when called during recursion.
The image is supposed to look something like the following, but how should I write it for kotlin?

var lists = moge || mutableListOf<String>? ()
Current status
mogemoge.hogehoge (row, null) // first time
fun hogehoge (row: List, moge: MutableList<String&gt ;?) {
       val lists // Initialization description

        value.add (~~~~~)
        if (~~~~~) {
            hogehoge (row, lists)
        }