Here is an example:
scala> val xs = List(1,2,3).toIterator.toSeq
xs: Seq[Int] = Stream(1, ?)
A sequence is a materialized set (the default is a List), so I expected to toSeqreturn List, notStream
The implementation is done in TraversableOnce,
def toSeq: Seq[A] = toStream
why is it not redefined in TraversableLike?
source
share