title: Find matching Predicate. Predicate of Predicate?
body: <p>I have a collection of <code>Predicates</code>, say <code>List&lt;Predicate&lt;File&gt;&gt;</code>. I then have a single <code>File</code> and I need to get the predicate (if any) that matches the file. I was thinking along the lines of using <code>Iterables.find()</code> but of course that takes a <code>Predicate</code> not a value to pass into a <code>Predicate</code>. I thought about implementing the following but don't know if there already exists a mechanism.</p>
  
  <pre><code>public static &lt;T&gt; Predicate&lt;Predicate&lt;? super T&gt;&gt; createInversePredicate(
          final T value) {
      return new Predicate&lt;Predicate&lt;? super T&gt;&gt;() {
  
          @Override
          public boolean apply(Predicate&lt;? super T&gt; input) {
              return input.apply(value);
          }
      };
  }
  </code></pre>
  
  <p>This would allow me to do the following:</p>
  
  <pre><code>private List&lt;Predicate&lt;File&gt;&gt; filters = ...;
  
  @Nullable
  Predicate&lt;File&gt; findMatching(File file){
      return Iterables.find(filters, createInversePredicate(file), null);
  }
  </code></pre>
  
  <p>Is there a better way?</p>