title: Return first result matching predicate in a Java stream or all non-matching results
body: <p>I have a <code>Validator</code> interface which provides a <code>isValid(Thing)</code> method, returning a <code>ValidationResult</code> which contains a <code>boolean</code> and a reason message.</p>
  
  <p>I want to create a <code>ValidatorAggregator</code> implementation of this interface which performs an OR across multiple <code>Validator</code>s (if any <code>Validator</code> returns a positive result, then the result is positive).  If any validator succeeds, I'd like to short-circuit and just return its result.  If no validator succeeds, I want to return all of the failure messages.</p>
  
  <p>I can do this succinctly using a stream and <code>findFirst().orElse(...)</code> but using this pattern I lose all the intermediate results if <code>findFirst</code> returns empty:</p>
  
  <pre><code>public ValidationResult isValid(final Thing thing) {
      return validators.stream()
        .map(v -&gt; validator.isValid(thing))
        .filter(ValidationResult::isValid)
        .findFirst()
        .orElseGet(() -&gt; new ValidationResult(false, "All validators failed'));
  }
  </code></pre>
  
  <p>Is there any way to capture the failed results using a stream, or indeed just more succinctly than the below?</p>
  
  <pre><code>public ValidationResult isValid(final Thing thing) {
      final Set&lt;ValidationResult&gt; failedResults = new HashSet&lt;&gt;();
      for (Validator validator : validators) {
          final ValidationResult result = validator.isValid(thing);
          if (result.isValid()) {
              return result;
          }
          failedResults.add(result);
      }
      return new ValidationResult(false, "No successful validator: " + failedResults); 
      // (assume failedResults stringifies nicely)
  }
  </code></pre>
  
  <hr>
  
  <p>Edit: based on comments, I agree what I'm trying to do is premature optimisation (particularly as these validators are very lightweight).  I'll probably go with something similar to Holger's solution of computing all validations and partitioning into successful/unsuccessful results. </p>
  
  <p><em>This was marked as a dupe of <a href="https://stackoverflow.com/questions/19940319/can-you-split-a-stream-into-two-streams">Can you split a stream into two streams?</a> and the <code>partitioningBy</code> answer sort-of is, but I think this question is asking, and the discussion answering, a different problem.</em></p>