title: SonarLint: Replace this lambda with a method reference
body: <p>I have a collection that contains a list of errors. I wanted to group these by a key (UUID UserId). For this I have copied the code from this answer:
  <a href="https://stackoverflow.com/a/30202075/4045364">https://stackoverflow.com/a/30202075/4045364</a></p>
  
  <pre><code>Collection&lt;FilterError&gt; filterErrors = new ArrayList&lt;FilterError&gt;();
  
  // ... some filterErrors get added to the collection ...
  
  return filterErrors.stream().collect(Collectors.groupingBy(w -&gt; w.getUserId()));
  </code></pre>
  
  <p>Sonar Lint gives me the following error: </p>
  
  <blockquote>
    <p>Replace this lambda with a method reference. <code>-&gt;</code></p>
  </blockquote>
  
  <p><strong>What I have tried:</strong>   </p>
  
  <p>Based on these question: <a href="https://stackoverflow.com/questions/35507937/sonar-replace-this-lambda-with-a-method-reference">SONAR: Replace this lambda with a method reference</a> and <a href="https://stackoverflow.com/questions/46612287/runable-interface-replace-this-lambda-with-a-method-reference-sonar-java-sou">Runable Interface : Replace this lambda with a method reference. (sonar.java.source not set. Assuming 8 or greater.)</a></p>
  
  <pre><code>filterErrors.stream().collect(Collectors.groupingBy(this::getUserId()));
  </code></pre>
  
  <p>Based on this question: <a href="https://stackoverflow.com/questions/45238341/replace-this-lambda-with-method-reference-objectsnonnull">Replace this lambda with method reference &#39;Objects::nonNull&#39;</a></p>
  
  <pre><code>filterErrors.stream().collect(Collectors.groupingBy(UUID::getUserId()));
  </code></pre>
  
  <p>Both give the error: </p>
  
  <blockquote>
    <p>The target type of this expression must be a functional interface</p>
  </blockquote>
  
  <p>Is there a way I can resolve this SonarLint issue?</p>