title: Why does Stream.allMatch() return true for an empty stream?
body: <p>My colleague and I had a bug that was due to our assumption that an empty stream calling <code>allMatch()</code> would return <code>false</code>. </p>
  
  <pre><code>if (myItems.allMatch(i -&gt; i.isValid()) { 
      //do something
  }
  </code></pre>
  
  <p>Of course, it is kind of our fault for assuming and not reading documentation. But what I don't understand is why the default <code>allMatch()</code> behavior for an empty stream returns <code>true</code>. What was the reasoning for this? Like the <code>anyMatch()</code> (which contrarily returns false), this operation is used in an imperative way that departs the monad and probably used in an <code>if</code> statement. Considering those facts, is there any reason why having <code>allMatch()</code> default to <code>true</code> on an empty stream be desirable for majority of uses?  </p>