/** * Creates and returns new assertion set holding content of all provided policy assertion sets. * <p/> * This method should not be used to perform a merge of general Policy instances. A client should be aware of the * method's result meaning and the difference between merge of Policy instances and merge of AssertionSet instances. * * * @param alternatives collection of provided policy assertion sets which content is to be stored in the assertion set. * May be {@code null} - empty assertion set is returned in such case. * @return new instance of assertion set holding the content of all provided policy assertion sets. */ public static AssertionSet createMergedAssertionSet(final Collection<AssertionSet> alternatives) { if (alternatives == null || alternatives.isEmpty()) { return EMPTY_ASSERTION_SET; } final AssertionSet result = new AssertionSet(alternatives); Collections.sort(result.assertions, ASSERTION_COMPARATOR); return result; }
/** * Creates and returns new assertion set holding a set of provided policy assertions. * * @param assertions collection of provided policy assertions to be stored in the assertion set. May be {@code null}. * @return new instance of assertion set holding the provided policy assertions */ public static AssertionSet createAssertionSet(final Collection<? extends PolicyAssertion> assertions) { if (assertions == null || assertions.isEmpty()) { return EMPTY_ASSERTION_SET; } final AssertionSet result = new AssertionSet(new LinkedList<PolicyAssertion>()); result.addAll(assertions); Collections.sort(result.assertions, ASSERTION_COMPARATOR); return result; }