title: How to select only certain items from a collection using Streams in Java
body: <p>I am trying to select only names from a collection using streams: These are the entries:</p>
  <pre><code>Person{id=4, name=E, color=red}] 
  [Person{id=0, name=A, color=blue}
  Person{id=1, name=B, color=green}
  Person{id=2, name=D, color=pink}
  Person{id=0, name=C, color=yellow 
  </code></pre>
  <p>I've tried using map, but it doesn't seem to alter the list since the function I'm mapping it to is supposed to be a getter method.</p>
  <pre><code>list.stream().map(p -&gt; getter.apply(p))collect(Collectors.toList());
  </code></pre>