8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 70a1166 commit 5fa663cCopy full SHA for 5fa663c
_overviews/scala-book/vector-class.md
@@ -52,13 +52,13 @@ The REPL shows how this works:
52
53
```scala
54
scala> val a = Vector(1,2,3)
55
-a: Vector[Int] = List(1, 2, 3)
+a: Vector[Int] = Vector(1, 2, 3)
56
57
scala> val b = a :+ 4
58
-b: Vector[Int] = List(1, 2, 3, 4)
+b: Vector[Int] = Vector(1, 2, 3, 4)
59
60
scala> val b = a ++ Vector(4, 5)
61
-b: Vector[Int] = List(1, 2, 3, 4, 5)
+b: Vector[Int] = Vector(1, 2, 3, 4, 5)
62
```
63
64
You can also *prepend* elements like this:
@@ -77,10 +77,10 @@ Once again the REPL shows how this works:
77
78
79
scala> val b = 0 +: a
80
-b: Vector[Int] = List(0, 1, 2, 3)
+b: Vector[Int] = Vector(0, 1, 2, 3)
81
82
scala> val b = Vector(-1, 0) ++: a
83
-b: Vector[Int] = List(-1, 0, 1, 2, 3)
+b: Vector[Int] = Vector(-1, 0, 1, 2, 3)
84
85
86
Because `Vector` is not a linked-list (like `List`), you can prepend and append elements to it, and the speed of both approaches should be similar.
0 commit comments