title: Non-static method cannot be referenced from a static context inside Collectors.toMap
body: <p>I have a list of Students which I want to convert into a <code>Map&lt;String, Integer&gt;</code>, where the map key should be the first name of the student. To keep the code sample simple, I specified the map value as <code>1</code>:</p>
  
  <pre><code>final Map&lt;String, Integer&gt; map = someStudents.stream().collect(
          Collectors.toMap(Student::getFirstName, 1));
  </code></pre>
  
  <p>The compiler complains about:</p>
  
  <blockquote>
    <p>non-static method getFirstName() cannot be referenced from a static context</p>
  </blockquote>
  
  <p>Any idea? I am confused because many examples use the same approach of passing a reference to the non-static method. Why does the compiler see a static context here?</p>