Starting with a Scala list.
val list = List(1,2,3,4)
How can I convert it to a TraversableOnce?
You already have one, since List[A]
is a subtype of TraversableOnce[A]
. You should not need to do anything to convert it.
To verify this:
scala> implicitly[List[Int] <:< TraversableOnce[Int]]
res0: <:<[List[Int],TraversableOnce[Int]] = <function1>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With