title: calling Iterables.contains for a subfield of object list
body: <p>I would like to be able to test if a List contain an object with a given key-value</p>
  
  <p>For example, I would like to do something like <em>Iterables.contains(l2, "lname", "Jordan"));</em>  instead of having to create all other Map objects like below in l2</p>
  
  <pre><code>//List&lt;String&gt; l = Arrays.asList("Mickael", "Jordan", "His Airness");
  //System.out.println(Iterables.contains(l, "Jordan"));
  
  Map&lt;String, String&gt; p1 = new HashMap&lt;String, String&gt;();
  p1.put("fname", "Mickael");
  p1.put("lname", "Jordan");
  p1.put("nname", "His Airness");
  
  Map&lt;String, String&gt; p2 = new HashMap&lt;String, String&gt;();
  p2.put("fname", "Paul");
  p2.put("lname", "Pierce");
  p2.put("nname", "The Truth");
  List&lt;Map&lt;String, String&gt;&gt; l2 = Arrays.asList(p1, p2);
  Map&lt;String, String&gt; p3 = new HashMap&lt;String, String&gt;();
  p3.put("fname", "Mickael"); //
  p3.put("lname", "Jordan");
  p3.put("nname", "His Airness"); //
  System.out.println(Iterables.contains(l2, p3));
  </code></pre>
  
  <p>I'd like to know if there's such guava's function, and not doing a loop on l2 and testing each elt.get("lname")</p>
  
  <p><em><strong>Edit</em></strong></p>
  
  <p>3 solutions answered: trying to see which one is more perfomant</p>
  
  <pre><code>System.out.println(Iterables.any(l2, withEntry("lname", "Jordan"))); //@axtavt
  System.out.println(has("lname", "Jordan")); //@JB
  System.out.println(Iterables.any(l2, new KeyValuePredicate("lname", "Jordan"))); //@JB
  
  public static Boolean has(final String key, final String value) {
      return Iterables.any(l2, new Predicate&lt;Map&lt;String, String&gt;&gt;() {
          @Override
          public boolean apply(Map&lt;String, String&gt; input) {
              return input.get(key).equals(value);
          }
      });
  }
  
  public static Predicate&lt;Map&lt;String, String&gt;&gt; withEntry(final String key, final String value) {
      return new Predicate&lt;Map&lt;String, String&gt;&gt;() {
          public boolean apply(Map&lt;String, String&gt; input) {
              return value.equals(input.get(key));
          }
      };
  }
  
  class KeyValuePredicate implements Predicate&lt;Map&lt;String, String&gt;&gt;{
  private String key;
  private String value;
  public KeyValuePredicate(String key, String value) {
      super();
      this.key = key;
      this.value = value;
  }
  @Override
  public boolean apply(Map&lt;String, String&gt; arg0) {
      // TODO Auto-generated method stub
      return arg0.get(key).equals(value);
  }
  
  }
  </code></pre>