private[this]object MMMap extends HashMap[A, Set[B]] with MultiMap[A, B]
How convert it to immutable?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The immutable hierarchy doesn’t contain a MultiMap, so you won’t be able to use the converted structure with the same convenient syntax. But if you’re happy to deal with key/valueset pairs, then:
If you just want a mutable
HashMap, you can just usex.toMapin 2.8 orcollection.immutable.Map(x.toList: _*)in 2.7.But if you want the whole structure to be immutable–including the underlying set!–then you have to do more: you need to convert the sets along the way. In 2.8:
In 2.7: