How does one convert a Scala Array
to a mutable.Set
?
It's easy to convert to an immutable.Set
:
Array(1, 2, 3).toSet
But I can't find an obvious way to convert to a mutable.Set
.
scala> val s=scala.collection.mutable.Set()++Array(1,2,3)
s: scala.collection.mutable.Set[Int] = Set(2, 1, 3)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With