title: Java8: HashMap<X, Y> to HashMap<X, Z> using Stream / Map-Reduce / Collector
body: <p>I know how to &quot;transform&quot; a simple Java <code>List</code> from <code>Y</code> -&gt; <code>Z</code>, i.e.:</p>
  <pre><code>List&lt;String&gt; x;
  List&lt;Integer&gt; y = x.stream()
          .map(s -&gt; Integer.parseInt(s))
          .collect(Collectors.toList());
  </code></pre>
  <p>Now I'd like to do basically the same with a Map, i.e.:</p>
  <pre><code>INPUT:
  {
    &quot;key1&quot; -&gt; &quot;41&quot;,    // &quot;41&quot; and &quot;42&quot;
    &quot;key2&quot; -&gt; &quot;42&quot;      // are Strings
  }
  
  OUTPUT:
  {
    &quot;key1&quot; -&gt; 41,      // 41 and 42
    &quot;key2&quot; -&gt; 42       // are Integers
  }
  </code></pre>
  <p>The solution should not be limited to <code>String</code> -&gt; <code>Integer</code>. Just like in the <code>List</code> example above, I'd like to call any method (or constructor).</p>