title: In Java 7 or below, HOWTO filter a list of map objects using key/value found in the map
body: <p>I have a list of map objects. These map objects have properties/keys like id, condition_1, condition_2 etc. A sample map looks like so,</p>
  
  <pre><code>List&lt;Map&lt;String, Object&gt;&gt; allItems = Lists.newArrayList();
  
  Map&lt;String, Object&gt; paramsMap = Maps.newHashMap();
  
  paramsMap.put("id", "a");
  paramsMap.put("condition_1", false);
  paramsMap.put("condition_2", true);
  paramsMap.put("condition_3", false);
  
  allItems.add(paramsMap);
  </code></pre>
  
  <p>So, I need to filter the <code>allItems</code> object such that it has only those map objects which have <code>condition_1 = true</code> &amp; <code>condition_2 = false</code>, &amp; so on &amp; so forth.</p>
  
  <p>I thought about using apache commons <a href="http://commons.apache.org/proper/commons-collections/javadocs/api-release/org/apache/commons/collections4/CollectionUtils.html#filter(java.lang.Iterable,%20org.apache.commons.collections4.Predicate)" rel="nofollow">CollectionUtils.filter</a> but that doesn't seem to solve my problem because I have no way of specifying map entries as filter conditions.</p>
  
  <p>I am not averse to using Google Guava as well, but I was unable to find a good solution.</p>
  
  <p>Basically I am trying to mimic the <a href="http://documentcloud.github.io/underscore/#where" rel="nofollow"><code>_.where</code></a> functionality found in the excellent JavaScript library underscore.js.</p>