Closed Ichoran closed 6 years ago
scala> val m = strawman.collection.mutable.HashSet(1) m: strawman.collection.mutable.HashSet[Int] = HashSet(1) scala> val s = strawman.collection.mutable.HashSet.empty[Int] s: strawman.collection.mutable.HashSet[Int] = HashSet() scala> m.flatMapInPlace(_ => s) res0: m.type = HashSet(1)
and also
scala> val m = strawman.collection.mutable.HashSet(1) m: strawman.collection.mutable.HashSet[Int] = HashSet(1) scala> m.flatMapInPlace(i => strawman.collection.mutable.HashSet(i+1)) res1: m.type = HashSet(1, 2)
@Ichoran I proposed a solution to this since the original implementation seems to never add any element to the toRemove variable that supposed to be used to drop elements.
toRemove
and also