public static <T> Predicate<T> andPredicates(final Predicate<T> predicate1,
                                                 final Predicate<T> predicate2) {
        if (predicate1 == null && predicate2 == null) {
            return null;
        } else {
            if (predicate1 == null) {
                return predicate2;
            } else if (predicate2 == null) {
                return predicate1;
            } else {
                return predicate1.and(predicate2);
            }
        }
    }
Chains predicates together using an AND. predicate2 will be tested after predicate1.

@return A single predicate representing predicate1 AND predicate2, or if predicate1
and predicate2 are null
stroom-util/src/main/java/stroom/util/PredicateUtil.java