What will be the result of comparing Maps with the same elements in different order?
val myMap1 = Map("MI" -> "Michigan", "OH" -> "Ohio", "WI" -> "Wisconsin", "IA" -> "Iowa")
val myMap2 = Map("WI" -> "Wisconsin", "MI" -> "Michigan", "IA" -> "Iowa", "OH" -> "Ohio")

myMap1.equals(myMap2)
Explanation
Map equivalency is independent of order.

Source: Scala Exercises: Maps

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback