/** * Factory to create the predicate. * * @param <T> the type that the predicate queries * @param predicate1 the first predicate to check, not null * @param predicate2 the second predicate to check, not null * @return the <code>and</code> predicate * @throws NullPointerException if either predicate is null */ public static <T> Predicate<T> andPredicate(final Predicate<? super T> predicate1, final Predicate<? super T> predicate2) { if (predicate1 == null || predicate2 == null) { throw new NullPointerException("Predicate must not be null"); } return new AndPredicate<>(predicate1, predicate2); }
/** * Create a new Predicate that returns true only if both of the specified * predicates are true. * * @param <T> the type that the predicate queries * @param predicate1 the first predicate, may not be null * @param predicate2 the second predicate, may not be null * @return the <code>and</code> predicate * @throws NullPointerException if either predicate is null * @see AndPredicate */ public static <T> Predicate<T> andPredicate(final Predicate<? super T> predicate1, final Predicate<? super T> predicate2) { return AndPredicate.andPredicate(predicate1, predicate2); }
@Override public Collection<OccurrenceIF> getOccurrences(String value, final LocatorIF datatype, final TopicIF occurrenceType) { return CollectionUtils.select(extractExactValues(occurs, value), new AndPredicate<>(new DataTypePredicate(datatype), new TypedPredicate(occurrenceType))); }