Preferred way to create a Scala list

后端 未结 10 2697
走了就别回头了
走了就别回头了 2020-12-02 04:31

There are several ways to construct an immutable list in Scala (see contrived example code below). You can use a mutable ListBuffer, create a var list and modif

10条回答
  •  难免孤独
    2020-12-02 05:30

    To create a list of string, use the following:

    val l = List("is", "am", "are", "if")
    

提交回复
热议问题