/** * Factory method to create a predicated (validating) set. * <p> * If there are any elements already in the set being decorated, they * are validated. * * @param <E> the element type * @param set the set to decorate, must not be null * @param predicate the predicate to use for validation, must not be null * @return a decorated set * @throws NullPointerException if set or predicate is null * @throws IllegalArgumentException if the set contains invalid elements * @since 4.0 */ public static <E> PredicatedSet<E> predicatedSet(final Set<E> set, final Predicate<? super E> predicate) { return new PredicatedSet<>(set, predicate); }