The concatenation of Scala map is obtained by utilizing ++ operator.
def ++(xs: Map[(A, B)]): Map[A, B]
It returns a single map by concatenating two maps but it separates the identical keys.
Map(Nidhi -> 23, Rahul -> 18, Geeta -> 22)
As we can see in above example, we joined two maps by using ++ operator.
Map(geeks -> 5, for -> 3, cs -> 2)
- Scala Tutorial – Learn Scala with Step By Step Guide
- Scala Map
- Set in Scala | Set-2
- Scala | Either
- Set in Scala | Set-1
- Scala Byte &(x: Int): Int
- StringBuilder in Scala
- Scala map contains() method with example
- Scala Set last() method with example
- Scala this keyword
- Scala | Option
- Scala Set map() method with example
- Scala Stream
- Scala Byte ^(x: Int): Int
- Scala | Value Classes
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.