Skip to content

Commit 4315eb3

Browse files
committed
Hardcode snippet output
1 parent 876c386 commit 4315eb3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

_overviews/collections-2.13/conversion-between-option-and-the-collections.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ for {
1818
a <- Set(1)
1919
b <- Option(41)
2020
} yield (a + b)
21+
// : Set[Int] = Set(42)
2122
```
2223

2324
since the operation `flatMap` on the type `Set[Int]` takes a function returning an `IterableOnce`:
@@ -37,12 +38,14 @@ so although `Option[A]` is not a full collection it can be _viewed_ as one. For
3738

3839
```scala mdoc
3940
Some(42).drop(1)
41+
// : Iterable[Int] = List()
4042
```
4143

4244
expands to
4345

4446
```scala mdoc
4547
Option.option2Iterable(Some(42)).drop(1)
48+
// : Iterable[Int] = List()
4649
```
4750

4851
because `drop` is not defined on `Option`. A downside of the above implicit conversion is that instead of getting back an `Option[A]` we are left with an `Iterable[A]`. For this reason, `Option`’s documentation carries the following note:

0 commit comments

Comments
 (0)