Scala: pass Seq to var-args functions -


given function takes variable number of arguments, e.g.

def foo(os: string*) =   println(os.tolist) 

how can pass sequence of arguments function? write:

val args = seq("hi", "there") foo(args) 

obviously, not work.

foo(args:_*) trick. instead of applying sequence 1 single argument, each element in sequence used argument.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Website Login Issue developed in magento -

Can the constants be defined inside a model file of a framework in PHP? -