I need to remove some sets from a master set
. The following code shows the concept I intend to work but it is generating warnings for deprecation. The suggestion given by Scala is not useful as I want to repeatedly update master set. Could anyone suggest a simple alternative please?
scala> var setM = scala.collection.mutable.Set[Int](1, 2, 3, 4, 5)
setM: scala.collection.mutable.Set[Int] = HashSet(1, 2, 3, 4, 5)
scala> var setX = scala.collection.mutable.Set[Int](3, 4)
setX: scala.collection.mutable.Set[Int] = HashSet(3, 4)
scala> setM = setM -- setX
^
warning: method -- in trait SetOps is deprecated (since 2.13.0): Consider requiring an immutable Set mutated setM
scala> setM
res0: scala.collection.mutable.Set[Int] = HashSet(1, 2, 5)