title: Return a value from Java 8 forEach loop
body: <p>In the below example , someObjects is a set. I am trying to return true if a condition matches within the loop , however this doesn't seem to compile. However when I just add "return" it works fine.What is the issue that I need to fix?</p>
  
  <pre><code>public boolean find(){
  
      someObjects.forEach(obj -&gt; {
         if (some_condition_met) {
            return true;
         }
      });
  
      return false;
  }
  </code></pre>
  
  <p>Compilation Errors</p>
  
  <blockquote>
    <p>The method forEach(Consumer) in the type
    Iterable is   not applicable for the arguments ((
    obj) -> {})</p>
  </blockquote>