/** * Returns the sum of the given lists. This is their intersection * subtracted from their union. * * @param <E> the element type * @param list1 the first list * @param list2 the second list * @return a new list containing the sum of those lists * @throws NullPointerException if either list is null */ public static <E> List<E> sum(final List<? extends E> list1, final List<? extends E> list2) { return subtract(union(list1, list2), intersection(list1, list2)); }
List<String> nextPermittedValues = ListUtils.intersection(nextRequestedValues, nextAllowedValues); if (nextPermittedValues.size() > 0) { restrictedExistingList = true;
private static void addErrorIfSameTestSuiteIsInBothParallelOrSequential(List<String> testSuitesParallel, List<String> testSuitesSequential) { final List<String> intersection = ListUtils.intersection(testSuitesParallel, testSuitesSequential); if (!intersection.isEmpty()) { final String message = String.format(MESSAGE_BOTH_PARALLEL_AND_SEQUENTIAL_EXECUTION, getListForPrint(intersection)); log.error(message); throw new IllegalStateException(); } }
/** * Displays a warning message for test suites that have rules defined for sequential or parallel execution * but are not in active test suites. * * @param testSuites suite names contained in 'container' suites * @param testSuitesContained suite names contained in 'contained' suites * @param key run configuration property key */ private static void addWarningForSubsetOfRules(List<String> testSuites, List<String> testSuitesContained, String key) { List<String> intersectWithContained = ListUtils.intersection(testSuites, testSuitesContained); if (intersectWithContained.size() != testSuitesContained.size()) { List<String> notScheduledForRun = new ArrayList<>(testSuitesContained); notScheduledForRun.removeAll(intersectWithContained); log.warn(format(MESSAGE_NOT_SCHEDULED_FOR_RUN_RULES, getListForPrint(notScheduledForRun), key)); } }
@Override public GroupIdList getAllGroupIds( List<String> selectedRepos ) throws ArchivaRestServiceException { List<String> observableRepos = getObservableRepos(); List<String> repos = ListUtils.intersection( observableRepos, selectedRepos ); if ( repos == null || repos.isEmpty() ) { return new GroupIdList( Collections.<String>emptyList() ); } try { return new GroupIdList( new ArrayList<>( repositorySearch.getAllGroupIds( getPrincipal(), repos ) ) ); } catch ( RepositorySearchException e ) { log.error( e.getMessage(), e ); throw new ArchivaRestServiceException( e.getMessage(), e ); } }
List<String> nextPermittedValues = ListUtils.intersection(nextRequestedValues, nextAllowedValues); if (nextPermittedValues.size() > 0) { restrictedExistingList = true;
/** * @param filtersToCombine list of SectionFilters * @return section filter containing all included and excluded tags of the passed filters */ public static SectionFilter getCombinedSectionFilter(SectionFilter... filtersToCombine) { Bag<String> excludedTagBag = new HashBag<String>(); Bag<String> includedTagBag = new HashBag<String>(); for (SectionFilter sectionFilter : filtersToCombine) { excludedTagBag.addAll(sectionFilter.getExcludedTags()); includedTagBag.addAll(sectionFilter.getIncludedTags()); } List<String> excludedTagList = getBagAsUniqueList(excludedTagBag); List<String> includedTagList = getBagAsUniqueList(includedTagBag); List<String> intersection = ListUtils.intersection(includedTagList, excludedTagList); if (intersection.isEmpty()) { return new SectionFilter(includedTagList, excludedTagList); } String intersectionAsString = StringUtils.join(intersection, ", "); throw new GaleniumException("tags in included and excluded collide: [" + intersectionAsString + "]"); }
ListUtils.intersection(dbConsumers, configuration.getRepositoryScanning().getKnownContentConsumers());