title: How to make a Predicate from a custom list of Predicates in Java?
body: <p>I'm relatively new to programming and I have been wondering for past two days how to make a Predicate that is made from a custom list of other Predicates. So I've came up with some kind of solution. Below is a code snippet that should give you an idea. Because I have written it based on solely reading various pieces of documentations I have two questions: 1/ is it a good solution? 2/ is there some other, recommended solution for this problem?</p>
  
  <pre><code>public class Tester {
    private static ArrayList&lt;Predicate&lt;String&gt;&gt; testerList;
  
    //some Predicates of type String here...
  
    public static void addPredicate(Predicate&lt;String&gt; newPredicate) {
      if (testerList == null) 
                   {testerList = new ArrayList&lt;Predicate&lt;String&gt;&gt;();}
      testerList.add(newPredicate);
    }
  
    public static Predicate&lt;String&gt; customTesters () {
      return s -&gt; testerList.stream().allMatch(t -&gt; t.test(s));
  
    }
  }
  </code></pre>