title: Lambda expression if-else statement
body: <p>Hello I Just started learning Lambda expressions, how do I write this with Lambda expressions?</p>
  
  <pre><code>  public static void greaterThanFive(String str){
      if(str.length() &gt; 5){
          System.out.println("String length is larger than 5 ");
      }else{
          System.err.println("String length less than 5");
      }
  </code></pre>
  
  <p>if it was just an, if statement I could just do this:</p>
  
  <pre><code>Predicate&lt;String&gt; greaterThanFive = (s)-&gt; s.length() &gt; 5;
  </code></pre>
  
  <p>But I can't really figure out when it's an if-else statement. </p>