Tag: 模式匹配

什么`:_ *`(冒号下划线明星)在斯卡拉?

我有这样一个问题的代码: 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!") } 一切都很清楚,除了这一块: child ++ newChild : _*它是做什么的? 我站在那里有Seq [节点]连接到另一个节点,然后呢? 什么: _*做什么? 提前致谢