I have a map as given below in scala.
Map("x"-> "abc", "y"->"adc","z"->"abc", "l"-> "ert","h"->"dfg", "p"-> "adc")
I want the output as follows:
Map("abc"->["x","z"],"adc"->["y" , "p"], "ert"->"l", "dfg"->"h")
So, the output has the array as the value of those those keys which had same values in inital map. How can I get that done optimally?