/** * Gets a Predicate that always returns true. * * @param <T> the type that the predicate queries * @return the predicate * @see TruePredicate */ public static <T> Predicate<T> truePredicate() { return TruePredicate.truePredicate(); }
/** * Returns a new {@link Collection} containing {@code <i>a</i> - <i>b</i>}. * The cardinality of each element <i>e</i> in the returned {@link Collection} * will be the cardinality of <i>e</i> in <i>a</i> minus the cardinality * of <i>e</i> in <i>b</i>, or zero, whichever is greater. * * @param a the collection to subtract from, must not be null * @param b the collection to subtract, must not be null * @param <O> the generic type that is able to represent the types contained * in both input collections. * @return a new collection with the results * @see Collection#removeAll */ public static <O> Collection<O> subtract(final Iterable<? extends O> a, final Iterable<? extends O> b) { final Predicate<O> p = TruePredicate.truePredicate(); return subtract(a, b, p); }
/** * Factory to create the predicate. * <p> * If the collection is size zero, the predicate always returns true. * * @param <T> the type that the predicate queries * @param predicates the predicates to check, cloned, not 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 */ public static <T> Predicate<T> nonePredicate(final Collection<? extends Predicate<? super T>> predicates) { final Predicate<? super T>[] preds = FunctorUtils.validate(predicates); if (preds.length == 0) { return TruePredicate.<T>truePredicate(); } return new NonePredicate<>(preds); }
/** * Factory to create the predicate. * <p> * If the array is size zero, the predicate always returns true. * * @param <T> the type that the predicate queries * @param predicates the predicates to check, cloned, not null * @return the <code>any</code> predicate * @throws NullPointerException if the predicates array is null * @throws NullPointerException if any predicate in the array is null */ public static <T> Predicate<T> nonePredicate(final Predicate<? super T>... predicates) { FunctorUtils.validate(predicates); if (predicates.length == 0) { return TruePredicate.<T>truePredicate(); } return new NonePredicate<>(FunctorUtils.copy(predicates)); }
/** * Factory to create the predicate. * <p> * If the collection is size zero, the predicate always returns true. * If the collection is size one, then that predicate is returned. * * @param <T> the type that the predicate queries * @param predicates the predicates to check, cloned, not null * @return the <code>all</code> predicate * @throws NullPointerException if the predicates array is null * @throws NullPointerException if any predicate in the array is null */ public static <T> Predicate<T> allPredicate(final Collection<? extends Predicate<? super T>> predicates) { final Predicate<? super T>[] preds = validate(predicates); if (preds.length == 0) { return truePredicate(); } if (preds.length == 1) { return coerce(preds[0]); } return new AllPredicate<>(preds); }
/** * Factory to create the predicate. * <p> * If the array is size zero, the predicate always returns true. * If the array is size one, then that predicate is returned. * * @param <T> the type that the predicate queries * @param predicates the predicates to check, cloned, not null * @return the <code>all</code> predicate * @throws NullPointerException if the predicates array is null * @throws NullPointerException if any predicate in the array is null */ public static <T> Predicate<T> allPredicate(final Predicate<? super T>... predicates) { FunctorUtils.validate(predicates); if (predicates.length == 0) { return truePredicate(); } if (predicates.length == 1) { return coerce(predicates[0]); } return new AllPredicate<>(FunctorUtils.copy(predicates)); }
public BuildStructureShouldEndDecider(StructureDataUtil structureDataUtil) { this(structureDataUtil, TruePredicate.truePredicate()); }