I have the following piece of code from this question:
def addChild(n: Node, newChild: Node) = n match {
case Elem(prefix, label, attribs, scope, child @ _
child ++ newChild
- sequence:
- type ascription, a hint that helps compiler to understand, what type does that expression have_*
- placeholder accepting any value + vararg operatorchild ++ newChild : _*
expands Seq[Node]
to Node*
(tells the compiler that we're rather working with a varargs, than a sequence). Particularly useful for the methods that can accept only varargs.