title: Scala: How to create a Map[K,V] from a Set[K] and a function from K to V?
body: <p>What is the best way to create a <code>Map[K,V]</code> from a <code>Set[K]</code> and function from <code>K</code> to <code>V</code>?</p>
  
  <p>For example, suppose I have</p>
  
  <pre><code>scala&gt; val s = Set(2, 3, 5)
  s: scala.collection.immutable.Set[Int] = Set(2, 3, 5)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>scala&gt; def func(i: Int) = "" + i + i
  func: (i: Int)java.lang.String
  </code></pre>
  
  <p>What is the easiest way of creating a <code>Map[Int, String](2 -&gt; "22", 3 -&gt; "33", 5 -&gt; "55")</code></p>