Разница в Scala между (1 to 4).to[scala.collection.immutable.Set]
и (1 to 4).toSet
?
scala> (1 to 4).toSet
res37: scala.collection.immutable.Set[Int] = Set(1, 2, 3, 4)
scala> (1 to 4).to[scala.collection.immutable.Set]
res38: scala.collection.immutable.Set[Int] = Set(1, 2, 3, 4)
scala> (1 to 4).to[Set]
res39: Set[Int] = Set(1, 2, 3, 4)
scala> Set(1 to 4:_*)
res14: scala.collection.immutable.Set[Int] = Set(1, 2, 3, 4)