title: java8 stream doesn't change a class member
body: <p>I have this code:</p>
  
  <pre><code>Set&lt;String&gt; namesSet = new HashSet&lt;&gt;();
  
  @Override
  public boolean isValid(List&lt;String&gt; input) {
      input.stream().map(item -&gt; namesSet.add(item));
      return namesSet.size() == input.size();
  }
  </code></pre>
  
  <p><code>input</code> is a list with one item.</p>
  
  <p>How come this item is not added to the namesSet after the <code>stream::map</code> ?</p>
  
  <p><strong>update</strong> here is my fix:</p>
  
  <pre><code>Set&lt;String&gt; namesSet;
  
  @Override
  public boolean isValid(List&lt;String&gt; input) {
      namesSet = new HashSet&lt;&gt;();
      input.stream().forEach(item -&gt; namesSet.add(item));
      return namesSet.size() == input.size();
  }
  </code></pre>