0

I've encountered this code :

ListBuffer(comp: _*)

comp is of type List[String]

What is ListBuffer(comp: _*) achieving ? Specifically comp: _* ?

blue-sky
  • 51,962
  • 152
  • 427
  • 752
  • 3
    You could use [symbolhound](http://symbolhound.com/?q=scala+_*) to search for such symbols. – senia Sep 20 '13 at 10:04

1 Answers1

2

ListBuffer apply method takes a vararg parameter of some type A. In order to pass it some sequence of value, for example a List, without explicit extraction of values you can use _* which means: take all values from this sequence (comp in your case) and pass them into this function as an argument.

4lex1v
  • 21,367
  • 6
  • 52
  • 86