By Alvin Alexander. Last updated: January 13, 2018
The URL I’ve linked to has a discussion on how to use _*
as a Scala “splat” operator (also shown as :_*
), along with an example of “Scala tuple unpacking.”
The Scala _*
syntax is shown in my own example here:
object Test1 extends App { def printAll(strings: String*) { println("------") strings.foreach(println) } printAll() printAll("foo") printAll("foo", "bar") printAll("foo", "bar", "baz") // the special ":_*" syntax val fruits = List("apple", "banana", "cherry") printAll("numbers", fruits : _*) }