Sometimes I need to create a collection by mapping another one with different type. For example, some function needs List[_] as its parameter type, but I need to produce that by mapping a IndexedSeq[_]:
val r = (1 to n).map { ... }
someFunction(r.toList)
Although I can fulfill that by calling IndexedSeq[_]'s map method first followed by another call to toList, this produces a redundant intermediate collection. Is there any way to avoid this redundant step while still keeping code concise?