When I was trying to insert an element to a scala mutable set, I got the following output.
My code was as follows.
object sets{
def main(args:Array[String]):Unit={
var set1 = Set(1,2,3,4);
println(set1);
println(set1.+(6));
}
}
And the output was as follows.
Set(1,2,3,4)
Set(1,6,2,3,4)
Is there a specific reason for 6 being printed after 1 instead of after 4?