I have a map which is something like
val m = Map("foo" -> "bar", "faz" -> "baz")
I need to write a custom get
method, so that the key can be the key in the map with a number in the end.
So for example:
m.get("foo1") should return "bar"
I am looking for a good scala pattern to solve this problem.
Also I am generating the above map from a for loop using yield, so I can't do something like this
val m = CustomMap("foo" -> "bar")
Any solutions will be appreciated.
Thanks
Aucun commentaire:
Enregistrer un commentaire