title: How to return a default boolean value in java streams if element not found?
body: <p>I want to determine if a given string matches - ignoring case - one of the elements in a <code>List&lt;String&gt;</code>.</p>
  
  <p>I'm trying to achieve this with Java 8 streams. Here's my attempt using <code>.orElse(false)</code>:</p>
  
  <pre><code>public static boolean listContainsTestWord(List&lt;String&gt; list, String search) {
      if (list != null &amp;&amp; search != null) {
          return list.stream().filter(value -&gt; value.equalsIgnoreCase(search))
            .findFirst().orElse(false);
      }
      return false;
  }
  </code></pre>
  
  <p>but that doesn't compile.</p>
  
  <p>How should I code it to return whether a match is found or not?</p>