title: Java 8 nested loops to stream
body: <p>Trying to get my head round the Java 8 streams syntax with a simple example. Had a look at the other similar questions on this topic, but could not find any solutions that would match my example and would work for me. Basically I am trying to refactor the following snippet with two nested loops to use the new stream API:</p>
  
  <pre><code>List&lt;Car&gt; filteredCars = new ArrayList&lt;&gt;();
  
  for (Car car : cars) {
      for (Wheel wheel : wheels) {
          if (car.getColor() == wheel.getColor() &amp;&amp;
                  wheel.isWorking() == true ) {
              filteredCars.add(car);
              break;
          }
      }
  }
  
  return filteredCars;
  </code></pre>
  
  <p>Managed to come up with this which returns void:</p>
  
  <pre><code>return cars.stream().forEach(
      car -&gt; wheels.stream()
          .filter(wheel -&gt; wheel.getColor() == car.getColor() &amp;&amp;
                      wheel.isWorking() == true)
          .collect(Collectors.toList()));
  </code></pre>
  
  <p>What is wrong with the stream syntax above and what am I missing?</p>