Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are using an immutable list. The operations on the List return a new List. The old List remains unchanged. This can be very useful if another class / method holds a reference to the original collection and is relying on it remaining unchanged. You can either use different named vals as in</p> <pre><code>val myList1 = 1.0 :: 5.5 :: Nil val myList2 = 2.2 :: 3.7 :: mylist1 </code></pre> <p>or use a var as in</p> <pre><code>var myList = 1.0 :: 5.5 :: Nil myList :::= List(2.2, 3.7) </code></pre> <p>This is equivalent syntax for:</p> <pre><code>myList = myList.:::(List(2.2, 3.7)) </code></pre> <p>Or you could use one of the mutable collections such as</p> <pre><code>val myList = scala.collection.mutable.MutableList(1.0, 5.5) myList.++=(List(2.2, 3.7)) </code></pre> <p>Not to be confused with the following that does not modify the original mutable List, but returns a new value:</p> <pre><code>myList.++:(List(2.2, 3.7)) </code></pre> <p>However you should only use mutable collections in performance critical code. Immutable collections are much easier to reason about and use. One big advantage is that immutable List and <a href="http://www.scala-lang.org/api/current/#scala.collection.immutable.Vector" rel="nofollow noreferrer">scala.collection.immutable.Vector</a> are Covariant. Don't worry if that doesn't mean anything to you yet. The advantage of it is you can use it without fully understanding it. Hence the collection you were using by default is actually <a href="http://www.scala-lang.org/api/current/#scala.collection.immutable.List" rel="nofollow noreferrer">scala.collection.immutable.List</a> its just imported for you automatically.</p> <p>I tend to use List as my default collection. From 2.12.6 Seq defaults to immutable Seq prior to this it defaulted to immutable.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload