Preferred way to create a Scala list

后端 未结 10 2699
走了就别回头了
走了就别回头了 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

    Note: This answer is written for an old version of Scala.

    The Scala collection classes are going to be redesigned as of Scala 2.8, so be prepared to change the way you create lists very soon.

    What is the forward compatible way of creating a List? I have no idea since I haven't read the 2.8 docs yet.

    A PDF document describing the proposed changes of the collection classes

提交回复
热议问题