Skip to content

Commit 82bb519

Browse files
authored
Update creating-collections-from-scratch.md
edit for clarity
1 parent 1e5b88b commit 82bb519

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_overviews/collections-2.13/creating-collections-from-scratch.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ You have syntax `List(1, 2, 3)` to create a list of three integers and `Map('A'
2727

2828
List.apply(1.0, 2.0)
2929

30-
So this is a call to the `apply` method of the companion object of the `List` class. That method takes an arbitrary number of arguments and constructs a list from them. Every collection class in the Scala library has a companion object with such an `apply` method. It does not matter whether the collection class represents a concrete implementation, like `List`, or `LazyList` or `Vector`, do, or whether it is an abstract base class such as `Seq`, `Set` or `Iterable`. In the latter case, calling apply will produce some default implementation of the abstract base class. Examples:
30+
So this is a call to the `apply` method of the companion object of the `List` class. That method takes an arbitrary number of arguments and constructs a list from them. Every collection class in the Scala library has a companion object with such an `apply` method. It does not matter whether the collection class represents a concrete implementation, like `List`, `LazyList` or `Vector`, or whether it is an abstract base class such as `Seq`, `Set` or `Iterable`. In the latter case, calling apply will produce some default implementation of the abstract base class. Examples:
3131

3232
scala> List(1, 2, 3)
3333
res17: List[Int] = List(1, 2, 3)
@@ -59,4 +59,4 @@ The operations provided by collection companion objects are summarized in the fo
5959
| `C.range(start, end)` | The collection of integers `start` ... `end-1`. |
6060
| `C.range(start, end, step)`| The collection of integers starting with `start` and progressing by `step` increments up to, and excluding, the `end` value. |
6161
| `C.iterate(x, n)(f)` | The collection of length `n` with elements `x`, `f(x)`, `f(f(x))`, ... |
62-
| `C.unfold(init)(f)` | A collection that uses a function `f` to compute its next element and state, starting from the `init` state.|
62+
| `C.unfold(init)(f)` | A collection that uses a function `f` to compute its next element and state, starting from the `init` state.|

0 commit comments

Comments
 (0)