title: Pass parameters to Predicates
body: <p>I have the following map of the search criteria: </p>
  
  <pre><code>private final Map&lt;String, Predicate&gt; searchMap = new HashMap&lt;&gt;();
  
  private void initSearchMap() {
      Predicate&lt;Person&gt; allDrivers = p -&gt; p.getAge() &gt;= 16;
      Predicate&lt;Person&gt; allDraftees = p -&gt; p.getAge() &gt;= 18
              &amp;&amp; p.getAge() &lt;= 25
              &amp;&amp; p.getGender() == Gender.MALE;
      Predicate&lt;Person&gt; allPilots = p -&gt; p.getAge() &gt;= 23
              &amp;&amp; p.getAge() &lt;=65;
  
      searchMap.put("allDrivers", allDrivers);
      searchMap.put("allDraftees", allDraftees);
      searchMap.put("allPilots", allPilots);
  }
  </code></pre>
  
  <p>I am using this map in the following way: </p>
  
  <pre><code>pl.stream()
      .filter(search.getCriteria("allPilots"))
      .forEach(p -&gt; {
          p.printl(p.getPrintStyle("westernNameAgePhone"));
      });
  </code></pre>
  
  <p>I would like to know, how can I pass some parameters into the map of predicates?</p>
  
  <p>I.e. I would like to get predicate from a map by its string abbreviation and insert a parameter into the taken out from a map predicate.  </p>
  
  <pre><code>pl.stream()
      .filter(search.getCriteria("allPilots",45, 56))
      .forEach(p -&gt; {
          p.printl(p.getPrintStyle("westernNameAgePhone"));
      });
  </code></pre>
  
  <p>Here is the <a href="https://blueskyworkshop.com/topics/Java-Pages/lambda-collections/" rel="noreferrer">link</a> from I googled out this map-predicate approach.</p>