title: How to use a lambda to filter a boolean array in Java
body: <p>I want to split a string by <code>"||"</code> and count how many elements from the resulting array return <code>true</code> for a function <code>boolean isValid(String[] r)</code>.</p>
  
  <p>I'm trying to use <code>Arrays.stream</code> to evaluate and filter the array, and finally, filter the resulting array to only keep the true values.</p>
  
  <pre><code>boolean[] truthSet = Arrays.stream(range.split("\\s+))
                             .map(r -&gt; isValid(r))
                             .filter(b -&gt; _whatGoesHere_)
                             .toArray(boolean[]::new);
  </code></pre>
  
  <p>In place of <code>_whatGoesHere</code>, I tried putting <code>b</code>, <code>b == true</code>, to no avail. What's the right way to achieve this?</p>