title: Java 8 filter based on a boolean
body: <p>I want to be able to apply a filter based on the boolean passed in. </p>
  
  <pre><code>public static List&lt;Integer&gt; multiplyNumbers(List&lt;Integer&gt; input, boolean ignoreEven){
  
      return input.stream()
      .filter(number -&gt; !(number%2==0))
      .map(number -&gt; number*2)
      .collect(Collectors.toList());
  }
  </code></pre>
  
  <p>I want to make the filter step based on the ignoreEven flag. If its true, ignore even numbers. How do I go about doing it? I am doing this to avoid code duplication</p>