Example usage for java.util List containsAll

List of usage examples for java.util List containsAll

Introduction

In this page you can find the example usage for java.util List containsAll.

Prototype

boolean containsAll(Collection<?> c);

Source Link

Document

Returns true if this list contains all of the elements of the specified collection.

Usage

From source file:Alias2.java

public static void verifyAtLeast(List output, List expected) {
    verifyLength(output.size(), expected.size(), Test.AT_LEAST);
    if (!output.containsAll(expected)) {
        ListIterator it = expected.listIterator();
        while (output.contains(it.next())) {
        }//from  w  w  w  .j a v a 2  s .c o m
        throw new SimpleTestException("expected: <" + it.previous().toString() + ">");
    }
}

From source file:ubic.basecode.util.RegressionTesting.java

/**
 * Test whether two object arrays contain the same items in any order. The arrays are treated as Sets - repeats are
 * not considered.//from   ww w.java2 s.  c o m
 * 
 * @param a
 * @param b
 * @return
 */
public static boolean containsSame(Object[] a, Object[] b) {
    if (a.length != b.length)
        return false;

    List<Object> av = new ArrayList<Object>(a.length);
    List<Object> bv = new ArrayList<Object>(b.length);

    for (int i = 0; i < b.length; i++) {
        av.add(a[i]);
        bv.add(b[i]);
    }

    return av.containsAll(bv);

}

From source file:ubic.basecode.util.RegressionTesting.java

/**
 * Test whether two double arrays contain the same items in any order (tolerance is ZERO)
 * /*  ww w  . j  a v  a  2  s . c om*/
 * @param a
 * @param b
 * @return
 */
public static boolean containsSame(double[] a, double[] b) {
    if (a.length != b.length)
        return false;

    List<Double> av = new ArrayList<Double>(a.length);
    List<Double> bv = new ArrayList<Double>(b.length);
    for (int i = 0; i < b.length; i++) {
        av.add(new Double(a[i]));
        bv.add(new Double(b[i]));
    }

    return av.containsAll(bv);
}

From source file:org.apache.falcon.metadata.EntityRelationshipGraphBuilder.java

public static boolean areSame(Inputs oldProcessInputs, Inputs newProcessInputs) {
    if (oldProcessInputs == null && newProcessInputs == null) {
        return true;
    }// ww w. ja  v a 2 s  .  co m

    if (oldProcessInputs == null || newProcessInputs == null
            || oldProcessInputs.getInputs().size() != newProcessInputs.getInputs().size()) {
        return false;
    }

    List<Input> oldInputs = oldProcessInputs.getInputs();
    List<Input> newInputs = newProcessInputs.getInputs();

    return oldInputs.size() == newInputs.size() && oldInputs.containsAll(newInputs)
            && newInputs.containsAll(oldInputs);
}

From source file:org.apache.falcon.metadata.EntityRelationshipGraphBuilder.java

public static boolean areSame(Outputs oldProcessOutputs, Outputs newProcessOutputs) {
    if (oldProcessOutputs == null && newProcessOutputs == null) {
        return true;
    }/*from  w  ww. j  a va2  s . c om*/

    if (oldProcessOutputs == null || newProcessOutputs == null
            || oldProcessOutputs.getOutputs().size() != newProcessOutputs.getOutputs().size()) {
        return false;
    }

    List<Output> oldOutputs = oldProcessOutputs.getOutputs();
    List<Output> newOutputs = newProcessOutputs.getOutputs();

    return oldOutputs.size() == newOutputs.size() && oldOutputs.containsAll(newOutputs)
            && newOutputs.containsAll(oldOutputs);
}

From source file:io.gravitee.policy.oauth2.Oauth2Policy.java

static boolean hasRequiredScopes(JsonNode oauthResponseNode, List<String> requiredScopes,
        String scopeSeparator) {//  www. j  a  va2 s . c  om
    if (requiredScopes == null) {
        return true;
    }

    JsonNode scopesNode = oauthResponseNode.path(OAUTH_PAYLOAD_SCOPE_NODE);

    List<String> scopes;
    if (scopesNode instanceof ArrayNode) {
        Iterator<JsonNode> scopeIterator = scopesNode.elements();
        scopes = new ArrayList<>(scopesNode.size());
        List<String> finalScopes = scopes;
        scopeIterator.forEachRemaining(jsonNode -> finalScopes.add(jsonNode.asText()));
    } else {
        scopes = Arrays.asList(scopesNode.asText().split(scopeSeparator));
    }

    return scopes.containsAll(requiredScopes);
}

From source file:org.apache.atlas.repository.store.graph.v1.AtlasRelationshipStoreV1Test.java

protected static void verifyRelationshipAttributeList(AtlasEntity entity, String relationshipAttrName,
        List<AtlasObjectId> expectedValues) {
    Object refValue = entity.getRelationshipAttribute(relationshipAttrName);
    assertTrue(refValue instanceof List);

    List<AtlasObjectId> refList = (List<AtlasObjectId>) refValue;
    assertEquals(refList.size(), expectedValues.size());

    if (expectedValues.size() > 0) {
        assertTrue(refList.containsAll(expectedValues));
    }// ww w .j  ava 2 s.  c  o m
}

From source file:org.dash.valid.gl.GLStringUtilities.java

public static boolean checkHomozygous(List<List<String>> alleles) {
    if (alleles == null) {
        return false;
    }/*  ww  w.  j  av a 2  s. c  o  m*/

    if (alleles.size() <= 1) {
        return true;
    }

    int i = 0;
    int j = 0;

    for (List<String> haplotypeAlleles : alleles) {
        j = 0;
        for (List<String> haplotypeAllelesLoop : alleles) {
            if (i != j && haplotypeAlleles.containsAll(haplotypeAllelesLoop)) {
                return true;
            }
            j++;
        }
        i++;
    }

    return false;
}

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

/**
 * Displays an informative message in case there is at least one test suite left for default run mode.
 *
 * @param unspecifiedTestSuiteRunMode the default run mode for suites that don't explicitly mention a run mode.
 * @param activeSuites                the suite names that are active
 * @param sequentialSuites            the suite names to be executed in sequential manner
 * @param parallelSuites              the suite names to be executed in parallel
 */// ww  w .  j av a 2  s  . co m
private static void addInformativeNoteForUnspecifiedRules(final TestCaseRunMode unspecifiedTestSuiteRunMode,
        final List<String> activeSuites, final List<String> sequentialSuites,
        final List<String> parallelSuites) {
    List<String> union = union(sequentialSuites, parallelSuites);
    if (!union.containsAll(activeSuites)) {
        List<String> copy = new ArrayList<>(activeSuites);
        copy.removeAll(union);

        log.info(format(MESSAGE_TEST_SUITES_WITH_UNSPECIFIED_MAPPING, getListForPrint(copy),
                unspecifiedTestSuiteRunMode.name()));
    }
}

From source file:com.cloud.utils.StringUtils.java

public static boolean areTagsEqual(final String tags1, final String tags2) {
    if (tags1 == null && tags2 == null) {
        return true;
    }// ww w  .  j a v  a  2s  . c om

    if (tags1 != null && tags2 == null) {
        return false;
    }

    if (tags1 == null && tags2 != null) {
        return false;
    }

    final String delimiter = ",";

    final List<String> lstTags1 = new ArrayList<String>();
    final String[] aTags1 = tags1.split(delimiter);

    for (final String tag1 : aTags1) {
        lstTags1.add(tag1.toLowerCase());
    }

    final List<String> lstTags2 = new ArrayList<String>();
    final String[] aTags2 = tags2.split(delimiter);

    for (final String tag2 : aTags2) {
        lstTags2.add(tag2.toLowerCase());
    }

    return lstTags1.containsAll(lstTags2) && lstTags2.containsAll(lstTags1);
}