private Predicate getPredicate() {
    handleComparator();

    if (predicates.size() == 1) {
      Predicate predicate = predicates.get(0);
      if (not) {
        predicate = new NotPredicate(predicate);
        not = false;
      }
      return predicate;
    }
    throw new IllegalStateException("Can't return a predicate.");
  }
Allow for chaining of already constructed predicates
ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PredicateBuilder.java