This should be an obvious one but I've not yet found an elegant solution. For various reasons, I need to create an immutable Scala map (scala.collection.immutable.Map from Scala 2.10), but I can only write Java code. How do I do this?
The empty() method is utilized to make the map empty. Return Type: It returns an empty map.
The emptyMap() method is used to get the empty map (immutable). This map is serializable.
By default, Scala uses the immutable Map. If you want to use the mutable Map, you'll have to import scala. collection.
Wild guess - here goes nothing:
scala.collection.immutable.Map$.MODULE$.<…, …>empty()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With