title: Java 8 Streams - Throwing an exception in the middle of an iteration
body: <p>I have the following array </p>
  
  <pre><code>ArrayList&lt;Car&gt; list = new ArrayList&lt;&gt;();
  </code></pre>
  
  <p>I want to iterate it and throw an exception if it contains a certain value </p>
  
  <p>i.e. </p>
  
  <p>if at least one  </p>
  
  <pre><code>list.stream.filter(x -&gt; x.color.equals("Black"));
  </code></pre>
  
  <p>then I want to stop iteration and throw an exception.<br>
  Is there a way?</p>