In Scala Code
val s = Set(List(1,2,3).toSeq:_*)
how does the syntax work toSeq:_*? I know what the code does, I know what it does toSeq, I understand List(1,2,3).toSeq:Seq[Int]. Is this a toSeq:_*special case?
toSeq:_*
toSeq
List(1,2,3).toSeq:Seq[Int]
toSeqdoes nothing here and should be omitted. The following is equivalent:
Set(List(1, 2, 3): _*)
(Or even better, just write List(1, 2, 3).toSet.)
List(1, 2, 3).toSet
, , , , _*, ( , . 4.6.2 ). Seq, List, toSeq - .
_*
Seq
List
Source: https://habr.com/ru/post/1542175/More articles:Error installing PHP PEAR ubuntu 12.04 - phpDjango Validation - NoReverseMatch - djangoProblems encoding and decrypting email python - pythonDeleting a large amount of data and a primary index - phpFAP encoding for IMAP - pythonWhy does cross-compilation for ARM not work. / Configure? - gccPostgres function returns one record, but I have many records? - sqlChange class to ng-focus in angularJS - angularjsBest practice for loading foreign assemblies - c #End client connection when reverse web proxy server failure - reverse-proxyAll Articles