Example usage for java.util Collection contains

List of usage examples for java.util Collection contains

Introduction

In this page you can find the example usage for java.util Collection contains.

Prototype

boolean contains(Object o);

Source Link

Document

Returns true if this collection contains the specified element.

Usage

From source file:com.netflix.simianarmy.aws.conformity.rule.InstanceHasTag.java

/**
 * Checks whether the collection of tag keys are valid. The default implementation here is to check
 * whether the tags contain the required tags. The method can be overridden for different
 * rules./*from w w  w .  jav  a2 s  . c o m*/
 * @param TagNames
 *      The collection of security group names
 * @return
 *      true if the tag names are valid, false otherwise.
 */
protected boolean checkTags(Collection<String> TagNames) {
    for (String requiredTag : requiredTags) {
        if (!TagNames.contains(requiredTag)) {
            return false;
        }
    }
    return true;
}

From source file:com.google.code.ssm.spring.SSMCacheManagerTest.java

@Test
public void getCacheNames() {
    Collection<String> names = ssmCacheManager.getCacheNames();
    assertNotNull(names);/* www. j av  a 2  s  .c  o m*/
    assertEquals(5, names.size());
    assertTrue(names.contains("cache1"));
    assertTrue(names.contains("cache2"));
    assertTrue(names.contains("cache3"));
    assertTrue(names.contains("cache3Alias1"));
    assertTrue(names.contains("cache3Alias2"));
}

From source file:gov.nih.nci.cabig.ctms.web.WebToolsTest.java

private void assertContains(Collection<?> actual, Object expected) {
    assertTrue("Collection does not contain " + expected + ": " + actual, actual.contains(expected));
}

From source file:de.codecentric.boot.admin.controller.RegistryControllerTest.java

@Test
public void applications() {
    Application app = new Application("http://localhost", "FOO");
    app = controller.register(app).getBody();

    Collection<Application> applications = controller.applications(null);
    assertEquals(1, applications.size());
    assertTrue(applications.contains(app));
}

From source file:com.agiletec.plugins.jpblog.aps.tags.util.BlogPagerTagHelper.java

/**
 * Return true when the pager collection contains a content Id specified as parameter
 * @param request/*from w  ww. j  av a  2s  . co m*/
 * @param collection
 * @return
 */
public boolean isThereBlogContentIdParam(ServletRequest request, Collection collection) {
    if (StringUtils.isNotBlank(_contentId)) {
        if (collection instanceof List && collection.contains(this._contentId)) {
            return true;
        }
    }
    return false;
}

From source file:de.codecentric.boot.admin.controller.RegistryControllerTest.java

@Test
public void applicationsByName() {
    Application app = new Application("http://localhost:2", "FOO");
    app = controller.register(app).getBody();
    Application app2 = new Application("http://localhost:1", "FOO");
    app2 = controller.register(app2).getBody();
    Application app3 = new Application("http://localhost:3", "BAR");
    controller.register(app3).getBody();

    Collection<Application> applications = controller.applications("FOO");
    assertEquals(2, applications.size());
    assertTrue(applications.contains(app));
    assertTrue(applications.contains(app2));
    assertFalse(applications.contains(app3));
}

From source file:de.dhke.projects.cutil.collections.aspect.AspectMapKeySet.java

private boolean batchRemove(final Collection<?> c, final boolean retain) {
    for (K key : _keySet) {
        if (c.contains(key) != retain) {
            Map.Entry<K, V> entry = new DefaultMapEntry<>(key, _aspectMap.get(key));
            _aspectMap.notifyBeforeElementRemoved(_aspectMap, entry);
        }/*from w w  w  . j  a  v a2s  . c o  m*/
    }

    boolean wasRemoved = false;
    Iterator<K> iter = _aspectMap.getDecoratee().keySet().iterator();
    while (iter.hasNext()) {
        K key = iter.next();
        if (c.contains(key) != retain) {
            Map.Entry<K, V> entry = new DefaultMapEntry<>(key, _aspectMap.get(key));
            iter.remove();
            wasRemoved = true;
            _aspectMap.notifyAfterElementRemoved(_aspectMap, entry);
        }
    }
    return wasRemoved;
}

From source file:com.adaptris.core.marshaller.xstream.XStreamUtilsTest.java

@Test
public void testCreateParentFields() {
    Collection<String> resultCollection = XStreamUtils.createParentFields(WorkflowImp.class,
            "serviceCollection", ".");
    assertTrue(resultCollection.contains("com.adaptris.core.WorkflowImp.serviceCollection"));
    resultCollection = XStreamUtils.createParentFields(WorkflowImp.class, "serviceCollection", "-");
    assertTrue(resultCollection.contains("com.adaptris.core.WorkflowImp-serviceCollection"));
}

From source file:com.evolveum.midpoint.test.IntegrationTestTools.java

public static void assertNoGroupMember(DummyGroup group, String accountId) {
    Collection<String> members = group.getMembers();
    if (members == null) {
        return;/* ww  w .j a  va  2 s  . c  o m*/
    }
    assertFalse("Account " + accountId + " IS member of group " + group.getName()
            + " while not expecting it, members: " + members, members.contains(accountId));
}