title: Convert array to a Map of array index to value
body: <p>What's wrong with this code?</p>
  <pre><code>int[] nums = new int[] {8, 3, 4};
  Map&lt;Integer,Integer&gt; val2Idx = 
      IntStream.range(0, nums.length)
          .collect(Collectors.toMap(idx -&gt; idx, idx -&gt; nums[idx]));
  </code></pre>
  <p>I'm hoping to produce a <code>Map</code> with these values:</p>
  <pre><code>{0=8, 1=3, 2=4}
  </code></pre>
  <p>But the error is</p>
  <blockquote>
  <p>method collect in interface IntStream cannot be applied to given types;</p>
  </blockquote>