I was looking at a set example for scala and I noticed that when states3 was created the compiler changed the order of the members of that set, Wyoming was in 3rd place and now its last. Could someone please explain why this happens?
scala> val states = Set("Alabama", "Alaska", "Wyoming")
states: scala.collection.immutable.Set[String] = Set(Alabama, Alaska, Wyoming)
scala> val states2 = states + "Virginia"
states2: scala.collection.immutable.Set[String] =
Set(Alabama, Alaska, Wyoming, Virginia)
scala> val states3 = states2 + ("New York", "Illinois")
states3: scala.collection.immutable.Set[String] =
Set(Alaska, Virginia, Alabama, New York, Illinois, Wyoming)
example taken from Programming Scala: Scalability = Functional Programming + Objects by Dean Wampler