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 | Either
- Set in Scala | Set-2
- Scala Map
- Set in Scala | Set-1
- Scala Lists
- Scala | Ranges
- Scala | Annotation
- Scala | map() method
- Scala | Multithreading
- Scala | Arrays
- Scala Set &~() method with example
- Scala Map take() method with example
- Scala | Final
- Scala | Literals
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.