Syntax sugar: _* for treating Seq as method parameters

后端 未结 3 1050
忘掉有多难
忘掉有多难 2020-11-28 07:46

I just noticed this construct somewhere on web:

val list = List(someCollection: _*)

What does _* mean? Is this a syntax sugar

3条回答
  •  情歌与酒
    2020-11-28 08:23

    That's scala syntax for exploding an array. Some functions take a variable number of arguments and to pass in an array you need to append : _* to the array argument.

提交回复
热议问题