How do I make a simple list in scala?
I know that zip can make two lists into one list,
scala> List(1, 2, 3).zip(List("4", "5", "6"))
res0: List[(Int, Int)] = List((1,4), (2,5), (3,6))
however, I don't need 'res0'. I want it,
res0: List[Int] = List(1,4,2,5,3,6)
maybe i should use some "indexOF" or "zipWithIndex" but that seems more verbose than a good "way"
Is there an elegant way to make the list look like this example?
or do I need to use some "IF"?
+3
source to share