If you want to add option's content to a sequence, you can easily do that using ++
or appendAll
method.
This is possible because ++
expects collection and there is an implicit conversion from an option to collection in Scala.
But be careful with :+
because that expects just one element and no conversion will be applied and this happens:
Top comments (0)