title: Predicates vs if statements
body: <p>I have seen in some projects that people use <code>Predicate</code>s instead of pure if statements, as illustrated with a simple example below: </p>
  
  <pre><code>    int i = 5;
      // Option 1
      if (i == 5) {
          // Do something
          System.out.println("if statement");
      }
  
      // Option 2
      Predicate&lt;Integer&gt; predicate = integer -&gt; integer == 5;
      if (predicate.test(i)) {
          // Do something
          System.out.println("predicate");
      }
  </code></pre>
  
  <p>What's the point of preferring <code>Predicate</code>s over if statements?</p>