How to initialize List in Kotlin?

后端 未结 6 1673
清酒与你
清酒与你 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:11

    listOf top-level function to the rescue:

    val geeks = listOf("Fowler", "Beck", "Evans")
    

提交回复
热议问题