/** * Create a new Predicate that returns true if only one of the specified * predicates are true. The predicates are checked in iterator order. * If the collection of predicates is empty, then this predicate returns false. * * @param <T> the type that the predicate queries * @param predicates a collection of predicates to check, may not be null * @return the <code>one</code> predicate * @throws NullPointerException if the predicates collection is null * @throws NullPointerException if any predicate in the collection is null * @see OnePredicate */ public static <T> Predicate<T> onePredicate(final Collection<? extends Predicate<? super T>> predicates) { return OnePredicate.onePredicate(predicates); }
/** * Create a new Predicate that returns true if only one of the specified * predicates are true. * If the array of predicates is empty, then this predicate returns false. * * @param <T> the type that the predicate queries * @param predicates an array of predicates to check, may not be null * @return the <code>one</code> predicate * @throws NullPointerException if the predicates array is null * @throws NullPointerException if any predicate in the array is null * @see OnePredicate */ public static <T> Predicate<T> onePredicate(final Predicate<? super T>... predicates) { return OnePredicate.onePredicate(predicates); }