How to initialize List in Kotlin?

后端 未结 6 1675
清酒与你
清酒与你 2021-02-03 16:36

I see Kotlin has a List collection and I was wondering about different ways to initialize one. In Java, I could write:

List geeks = Ar         


        
6条回答
  •  说谎
    说谎 (楼主)
    2021-02-03 17:00

    Just for adding more info, Kotlin offers both immutable List and MutableList that can be initialized with listOf and mutableListOf. If you're more interested in what Kotlin offers regarding Collections, you can go to the official reference docs at Collections.

提交回复
热议问题