(Scala) How to convert List into a Seq

时间:2016-07-11 22:36:52

标签: scala

I have a function like

def myFunction(i:Int*) = i.map(a => println(a))

but I have a List of Int's.

val myList:List[Int] = List(1,2,3,4)

Desired output:
1
2
3
4

How can I programmatically convert myList so it can be inserted into myFunction?

1 个答案:

答案 0 :(得分:2)

Here it is:

myFunction(myList: _*)