What does single variable name in lambda closure?

47 Views Asked by At

I had method that get data from database to list using Anko library. I can't figure out what mean single variable name after lambda (i.e dataList in the end of the function). How it's translate to Java?

Code:

    fun gerData() : ArrayList<DataModelKotlin> = context.database.use {
        val dataList = ArrayList<DataModelKotlin>()
            select("TipList", "task", "id")
                    .parseList(object: MapRowParser<List<DataModelKotlin>>{
                        override fun parseRow(columns: Map<String, Any?>): List<DataModelKotlin> {
                            val task = columns.getValue("task")
                            val id = columns.getValue("id")

                            val dataModel = DataModelKotlin(text = task.toString(), id = id.toString().toInt())
                            dataList.add(dataModel)
                            return dataList
                        }

                    })
        dataList //???
    }
2

There are 2 best solutions below

0
On BEST ANSWER

It is the same with

return dataList; 

In Java

0
On