title: Return List from forEach using Stream in java
body: <p>I am trying to convert below for-loop to forEach method with help Stream function using Java1.8, but I was messed up and also confused to do that.</p>
  
  <pre><code>List&lt;A&gt; valueList = new ArrayList&lt;&gt;();
  List&lt;B&gt; responseList = getResponses();
  List&lt;A&gt; value = new ArrayList&lt;&gt;();
  
  for (B getResponse: responseList) {
      valueList = getValues(getResponse);
      value.addAll(valueList);
  }
  </code></pre>