Example usage for org.apache.commons.collections4 ListUtils intersection

List of usage examples for org.apache.commons.collections4 ListUtils intersection

Introduction

In this page you can find the example usage for org.apache.commons.collections4 ListUtils intersection.

Prototype

public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) 

Source Link

Document

Returns a new list containing all elements that are contained in both given lists.

Usage

From source file:com.thoughtworks.go.plugin.access.PluginExtensionsAndVersionValidatorImpl.java

private void validateExtensionVersions(ValidationResult validationResult, String extensionType,
        List<Double> gocdSupportedExtensionVersions, List<String> requiredExtensionVersionsByPlugin) {
    final List<Double> requiredExtensionVersions = requiredExtensionVersionsByPlugin.stream()
            .map(parseToDouble()).collect(toList());

    final List<Double> intersection = ListUtils.intersection(gocdSupportedExtensionVersions,
            requiredExtensionVersions);/*from  w  w w. j ava 2 s  .  c  om*/

    if (intersection.isEmpty()) {
        validationResult.addError(format(UNSUPPORTED_VERSION_ERROR_MESSAGE, extensionType,
                requiredExtensionVersionsByPlugin, gocdSupportedExtensionVersions));
    }
}

From source file:appsgate.lig.eude.interpreter.langage.nodes.NodeLists.java

/**
 * Method that compute the combination of the two lists depending on the
 * operator//from w ww  . j av a  2 s. c o m
 */
private void computeResult() {
    switch (op) {
    case UNION:
        result = ListUtils.sum(leftList.getElements(), rightList.getElements());
        break;
    case INTERSECTION:
        result = ListUtils.intersection(leftList.getElements(), rightList.getElements());
        break;
    case NOT_IN:
        result = ListUtils.subtract(leftList.getElements(), rightList.getElements());
        break;
    default:
        LOGGER.warn("Unknown operator");
    }
}

From source file:io.cloudslang.lang.tools.build.SlangBuildMain.java

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);/* w  w  w.  j  a v  a  2  s. c o  m*/
        throw new IllegalStateException();
    }
}

From source file:io.cloudslang.lang.tools.build.SlangBuildMain.java

/**
 * Displays a warning message for test suites that have rules defined for sequential or parallel execution
 * but are not in active test suites.// ww w .j  a  v a  2  s  .  co m
 *
 * @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));
    }
}