title: Java 8 Predicates
body: <p>Here is an example method that takes a Predicate as an argument:</p>
  
  <pre><code>void processFields(List&lt;WebDataField&gt; fields, Predicate&lt;WebDataField&gt; predicate) {
      for (WebDataField webDataField : fields) {
          boolean expectedCondition = predicate.test(webDataField);
      }
  }
  </code></pre>
  
  <p>And I call the above function as:</p>
  
  <pre><code>processFields(fields, w -&gt; w.getFieldName().length() &gt; 5);
  </code></pre>
  
  <p>Another function:</p>
  
  <pre><code>public void doSomething(Object someObject,Predicate&lt;T&gt; predicateInstance){
      //doSomething method's code goes here
  }
  </code></pre>
  
  <p>And on the calling side the method doSomething() will be called like this –</p>
  
  <pre><code>doSomething(someObjectInstance, Integer i-&gt; i&gt;10)
  </code></pre>
  
  <p>I checked the Java 8 documentation for String/Integer/Object etc and didn't find any of these class implementing the <code>Predicate&lt;T&gt;</code> interface. I don't know what I have missed in my Java 8 tutorial series, but I am not able to get this phenomenon:</p>
  
  <ol>
  <li><p>How does the compiler allow the lambda expression if the target type has no direct connection with Predicate class?</p></li>
  <li><p>Will the answer be same for both the above cases?</p></li>
  </ol>