What does `:_*` (colon underscore star) do in Scala?

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 @ _*) => Elem(prefix, label, attribs, scope, child ++ newChild : _*)
  case _ => error("Can only add children to elements!")
}

Everything in it is pretty clear, except this piece: child ++ newChild : _*

What does it do?

I understand there is Seq[Node] concatenated with another Node, and then? What does : _* do?

4 Answers
4

Leave a Comment