title: Google Guava - Filter Multiple Inputs on Single Property
body: <p>I just got into Google Guava and it seems like a powerful tool and  I see how you can use Predicates and filter by a specific property. How you can also chain predicates in <code>FluentIterable</code> My question is what's the best way to filter for a single property.</p>
  
  <p>For example, if I have a collection of Cars. How do I filter the Cars.getPaintColor() to give me cars that are in Black, Red, and Yellow? Creating 3 separate predicates and using FluentIterable seems clumsy. Especially in my use, I could want possibly 10+ filters on the same property and I wouldn't want to create 10 Predicates.</p>
  
  <p>Thanks you!</p>
  
  <pre><code>        List&lt;String&gt; colorList = (List&lt;String&gt;)filterCriteria.get("Color");
          List&lt;String&gt; makeList = (List&lt;String&gt;)filterCriteria.get("Make");
          List&lt;String&gt; rimSizeList = (List&lt;String&gt;)filterCriteria.get("RimSize");
  
          Predicate&lt;String&gt; predColor = Predicates.in(ImmutableSet.copyOf(colorList));
          Predicate&lt;CarObj&gt; predDirection2 = Predicates.compose(predColor ,[????] );
  
          Predicate&lt;String&gt; predMakeList  = Predicates.in(ImmutableSet.copyOf(makeList));
          Predicate&lt;CarObj&gt; predMakeList2 = Predicates.compose(predMakeList, [????] );
  
          Predicate&lt;String&gt; predRimSize = Predicates.in(ImmutableSet.copyOf(rimSizeList));
          Predicate&lt;CarObj&gt; predRimSize2 = Predicates.compose(predRimSize, [????] );
  
          Collection&lt;CarObj&gt; filtered = FluentIterable.from(mAllCars)
                  .filter(predDirection2)
                  .filter(predMakeList2)
                  .filter(predRimSize2)
                  .toList();
  </code></pre>
  
  <p>Since I am using an List, I used <code>copyOf</code> instead of <code>of</code> when creating ImmutableSet.</p>
  
  <p>I am not sure what to put in the second parameter of the compose. I am guessing it is something like this... in the CarObj class.</p>
  
  <pre><code>static Predicate&lt;CarObj&gt; byColor= new Predicate&lt;CarObj&gt;() {
      public boolean apply(CarObj input) {
  
          // What do I put here?
      }
  };
  </code></pre>