Difference between ArrayList() and mutableListOf() in Kotlin

后端 未结 3 1839
不思量自难忘°
不思量自难忘° 2020-12-02 16:07
private val repositories = mutableListOf()

private val repositories = ArrayList()

Both are mutable list, then what is

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-02 16:56

    As you can see in sources:

    public inline fun  mutableListOf(): MutableList = ArrayList()
    

    So, there is no difference, just a convenience method.

提交回复
热议问题