I have some code that takes a Seq[A], and maps it to a Seq[B]possibly in parallel, something like this :def f(s: Seq[A], enablePar: Boolean) =(if(enablePar) s.par else s).map(someTransformation(_)).toList.toSeqThe result must be a Seq[B], because I feed it to an API that I don't control,it wants a Seq[B] and it won't take a GenSeq, List, Iterable etc.
As Alex said, try
def f[A](s: Seq[A], enablePar: Boolean): Seq[A] =
((if (enablePar) s.par else s) map identity).seq
For clarification: `toSeq` is a method which transforms the collection
to something which is a `Seq`. `seq` however transforms it into
something which is not parallel, but sequential.