If I want to convert Range
to Set
, I can write
(0 to 9) .toSet
What if I need to convert Range
to SortedSet
? I can write something like:
scala.collection.immutable.SortedSet [Int] ((0 to 9): _ *)
scala.collection.immutable.SortedSet [Int] () ++ (1 to 9)
Does it make sense? Is there any βbetterβ (efficient / easy) way to convert Range
to SortedSet
?
source share