Must partitioningBy produce a map with entries for true and false?
<p>The <a href="https://docs.oracle.com/javase/8/docs/api/java/util/stream/Collectors.html#partitioningBy-java.util.function.Predicate-" rel="nofollow noreferrer"><strong>partitioningBy</strong></a> collector applies a predicate to each element in a stream and produces a map from booleans to lists of elements from the stream that satisfied or didn't satisfy the predicate.  For instance:</p>

<pre><code>Stream.of(1,2,3,4).collect(partitioningBy(x -&gt; x &gt;= 3))
// {false=[1, 2], true=[3, 4]}
</code></pre>

<p>As discussed in <a href="https://stackoverflow.com/questions/27993604/whats-the-purpose-of-partitioningby">What&#39;s the purpose of partitioningBy</a>, the <em>observed</em> behavior is that <strong>partitioningBy</strong> always returns a  map with entries for both <strong>true</strong> and <strong>false</strong>.  E.g.:</p>

<pre><code>Stream.empty().collect(partitioningBy(x -&gt; false));
// {false=[], true=[]}

Stream.of(1,2,3).collect(partitioningBy(x -&gt; false));
// {false=[1, 2, 3], true=[]}

Stream.of(1,2,3).collect(partitioningBy(x -&gt; true));
// {false=[], true=[1, 2, 3]}
</code></pre>

<p>Is that behavior actually specified somewhere? The Javadoc only says:</p>

<blockquote>
  <p>Returns a Collector which partitions the input elements according to a
  Predicate, and organizes them into a <code>Map&lt;Boolean, List&lt;T&gt;&gt;</code>. There are
  no guarantees on the type, mutability, serializability, or
  thread-safety of the Map returned.</p>
</blockquote>

<p>Could a conforming implementation return these instead:</p>

<pre><code>Stream.empty().collect(partitioningBy(x -&gt; false));
// {}, or {false=[]}, or {true=[]}

Stream.of(1,2,3).collect(partitioningBy(x -&gt; false));
// {false=[1, 2, 3]}

Stream.of(1,2,3).collect(partitioningBy(x -&gt; true));
// {true=[1, 2, 3]}
</code></pre>

<p>The corresponding <a href="https://jcp.org/en/jsr/detail?id=335" rel="nofollow noreferrer">JSR 335</a> only seems to include the same documentation, but not additional discussion about what entries the map will contain.</p>