Created
May 14, 2017 05:28
-
-
Save dgadiraju/964ce27ea1bf8eafa358d29ca32f7bbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val m = Map( | |
| (1, Order(1, "2017-01-01", 100, "COMPLETE")), | |
| (2, Order(2, "2017-01-01", 20, "CLOSED")) | |
| ) | |
| //as m is immutable we cannot use +=, ++=, -= and --= | |
| m + ((3, Order(3, "2017-01-01", 301, "PENDING"))) | |
| m + (3 -> Order(3, "2017-01-01", 301, "PENDING")) | |
| //let us define m as mutable Map | |
| val m = collection.mutable.Map( | |
| (1, Order(1, "2017-01-01", 100, "COMPLETE")), | |
| (2, Order(2, "2017-01-01", 20, "CLOSED")) | |
| ) | |
| //Now we can manipulate map by using +=, ++=, -=, --= | |
| m += ((3, Order(3, "2017-01-01", 301, "PENDING"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment