What is the best way to create a Map[K,V] from a Set[K] and function from K to V?
Map[K,V]
Set[K]
K
V
For example, suppose I have
Without definition of func(i: Int) using "string repeating" operator *:
scala> s map { x => x -> x.toString*2 } toMap res2: scala.collection.immutable.Map[Int,String] = Map(2 -> 22, 3 -> 33, 5 -> 55)