title: java - how to break from a forEach method using lambda expression
body: <p>Basically I have a list and its elements will be processed one by one until some condition is met. If that condition is met for any element, it should return <code>true</code> otherwise <code>false</code>. The method looks like:</p>
  
  <pre><code>public boolean method(List&lt;Integer&gt; data) {
      data.forEach(item -&gt; {
          if (some condition is met) {
              return true; //  Getting Unexpected return value here
          }
      });
      return false;
  }
  </code></pre>
  
  <p>Is there a way to break out of this forEach loop right after the condition is met instead of looping through all the elements?</p>