Hey,
You can concatenate/join two Maps in more than one way. Let’s take an example:
scala> var m1=Map("Giti"->3,"Ruchi"->2,"Niti"->4)
m1: scala.collection.immutable.Map[String,Int] = Map(Giti -> 3, Ruchi -> 2, Niti -> 4)
With ++ operator
scala> m++m1
res6: scala.collection.immutable.Map[String,Int] = Map(Ayushi -> 0, Giti -> 3, Ruchi -> 2, Niti -> 4)
scala> m1++m
res7: scala.collection.immutable.Map[String,Int] = Map(Giti -> 1, Ruchi -> 2, Niti -> 4, Ayushi -> 0)
Hope this helps!
If you need to know more about Scala, join Scala course today and become the expert.
Thanks!!