Reputation: 9
In MyMap = scala.collection.mutable.Map[List[String], Int]()
I have to match string inside MyMap, and get the value of corresponding Int. List of string represent topic of interest of my device, int is ID of device.
Upvotes: 0
Views: 231
Reputation: 7926
Why don't yo use a filter, it do the same as find, but returning all the elements which satisfies the predicate
myMap.filter(_._1.contains("target")).map(_._2)
or even
myMap.filter(_._1.contains("target")).values
Upvotes: 1