How to do that without creating any new collections? Is there something better than this?
val m = scala.collection.mutable.Map[String, Long](\"1\" -> 1, \"2\"
If you are using an immutable.Map, in 2.7 it might have to be something like:
immutable.Map
def pred(k: Int, v: String) = k % 2 == 0 m --= (m.filter(pred(_, _)).keys
As there is no retain method available. Obviously in this case m must be declared as a var
retain
m
var