title: How do I convert lambda parameters to usable objects?
body: <p>I'm trying to stream a list of Doubles into a <code>Map&lt;Double, Double&gt;</code>, where the keys are the Doubles in the original list, and the values are some computed value.</p>
  
  <p>This is what my code looks like:</p>
  
  <pre><code>// "values" is a List&lt;Double&gt; that was passed in
  ImmutableMap&lt;Double, Double&gt; valueMap = values.parallelStream()
      .collect(Collectors.toMap(p -&gt; p, p -&gt; doThing(values, p)));
  
  private Double doThing(List&lt;Double&gt;, Double p) {
      Double computedValue = 0.0;
      // Do math here with p
      return computedValue;
  }
  </code></pre>
  
  <p>However, IntelliJ is complaining that <code>p -&gt; p</code> is not a valid lambda expression - it's complaining about a cyclic inference. I'm also getting an error when I call <code>doThing</code>, because <code>p</code> is a lambda parameter and not a Double.</p>
  
  <p>When I try to cast <code>p</code> to a <code>Double</code> in the call to <code>doThing</code>, that fails to cast.</p>
  
  <p>Am I missing something really obvious? It seems like there's no way to actually do anything with my lambda parameters...</p>