title: how to express "(String a)-> a.contains("o")" using java 8 method reference
body: <p>the "String::contains" is wrong. but how to express the lambda?</p>
  
  <p>In addition , when I write this in IntelliJ IDEA :</p>
  
  <blockquote>
    <p>obj.testPredicate(list, String::contains);</p>
  </blockquote>
  
  <p>I get the error in "String::contains" : Non-static method cannot be referenced from a static context. but the contains is not static method. I am confused by the tips.</p>
  
  <p>my code as follows:</p>
  
  <pre><code>public &lt;T&gt; List&lt;T&gt; testPredicate(List&lt;T&gt; list , Predicate&lt;T&gt; predicate){
      List&lt;T&gt; result = new ArrayList&lt;&gt;();
      for(T t: list){
          if(predicate.test(t)){
              result.add(t);
          }
      }
      return result;
  }
  </code></pre>
  
  <p>and this is the caller:</p>
  
  <pre><code>@Test
  public void testPredicate() throws Exception {
      List&lt;String&gt; listTemp = lambda.testPredicate(list, s -&gt; s.contains("o"));
      System.out.println(listTemp);
  }
  </code></pre>
  
  <p><strong>why the simplest lambda cannot be replace by method reference?</strong> </p>
  
  <p>and I see the <a href="https://stackoverflow.com/questions/23139725/using-method-reference-instead-of-multi-argument-lambda">Using method reference instead of multi argument lambda</a>.</p>
  
  <p>it says </p>
  
  <blockquote>
    <p>(2) If func is an instance method, then SomeClass::func is a lambda that uses the first argument as the instance, as you thought:
    (a, b, c) -> a.func(b, c);</p>
  </blockquote>
  
  <p>there is no defference with my (String a, String b)-> a.contains(b); why method reference did not work?</p>