Example usage for java.util Collection addAll

List of usage examples for java.util Collection addAll

Introduction

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

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Adds all of the elements in the specified collection to this collection (optional operation).

Usage

From source file:com.sworddance.util.CUtilities.java

/**
 * Add a anotherCollection to a collection provided both the collection and the anotherCollection are not null.
 * @param <T>//w w  w  .j ava  2 s.  c o m
 * @param collection
 * @param anotherCollection
 * @return true if the value was added
 */
public static <T> boolean addAll(Collection<T> collection, Collection<T> anotherCollection) {
    return anotherCollection != null && collection != null && collection.addAll(anotherCollection);
}

From source file:com.adito.jdbc.JDBCSystemDatabase.java

private static Collection<String> getAlwaysAuthorizedIpAddresses() {
    String property = SystemProperties.get("adito.iprestrictions.allow", "");
    Collection<String> propertyAsCollection = property.length() == 0 ? Collections.<String>emptyList()
            : Arrays.asList(property.split(","));

    /* BPS - It is possible to spoof localhost, although most firewalls should prevent this happening,
     * do we really want to just allow localhost?
     *///from   ww  w  .  jav a2  s .c  o  m
    Collection<String> alwaysAuthorized = new HashSet<String>();
    alwaysAuthorized.add(LOCAL_HOST);
    alwaysAuthorized.add(LOCAL_LOOP_BACK_IPV4);
    alwaysAuthorized.add(LOCAL_LOOP_BACK_IPV6);
    alwaysAuthorized.add(LOCAL_LOOP_BACK_IPV6_EXT);
    alwaysAuthorized.addAll(propertyAsCollection);
    return alwaysAuthorized;
}

From source file:com.sslexplorer.jdbc.JDBCSystemDatabase.java

private static Collection<String> getAlwaysAuthorizedIpAddresses() {
    String property = SystemProperties.get("sslexplorer.iprestrictions.allow", "");
    Collection<String> propertyAsCollection = property.length() == 0 ? Collections.<String>emptyList()
            : Arrays.asList(property.split(","));

    /* BPS - It is possible to spoof localhost, although most firewalls should prevent this happening,
     * do we really want to just allow localhost?
     *//*from   ww w. j a va  2 s. c  om*/
    Collection<String> alwaysAuthorized = new HashSet<String>();
    alwaysAuthorized.add(LOCAL_HOST);
    alwaysAuthorized.add(LOCAL_LOOP_BACK_IPV4);
    alwaysAuthorized.add(LOCAL_LOOP_BACK_IPV6);
    alwaysAuthorized.add(LOCAL_LOOP_BACK_IPV6_EXT);
    alwaysAuthorized.addAll(propertyAsCollection);
    return alwaysAuthorized;
}

From source file:com.github.strawberry.redis.RedisLoader.java

private static Collection<?> collectionOf(Field field, Jedis jedis, String key) {
    Collection collection = collectionImplementationOf(field.getType());
    JedisType jedisType = JedisType.valueOf(jedis.type(key).toUpperCase());
    Option<Type> genericType = genericTypeOf(field, 0);
    switch (jedisType) {
    case STRING: {
        collection.add(jedis.get(key));/*from   w  ww .ja  v a2s.c  o m*/
    }
        break;
    case HASH: {
        collection.add(jedis.hgetAll(key));
    }
        break;
    case LIST: {
        if (genericType.exists(isAssignableTo(Collection.class))
                || genericType.exists(isEqualTo(Object.class))) {
            collection.add(jedis.lrange(key, 0, -1));
        } else {
            collection.addAll(jedis.lrange(key, 0, -1));
        }
    }
        break;
    case SET: {
        if (genericType.exists(isAssignableTo(Collection.class))
                || genericType.exists(isEqualTo(Object.class))) {
            collection.add(jedis.smembers(key));
        } else {
            collection.addAll(jedis.smembers(key));
        }
    }
        break;
    case ZSET: {
        if (genericType.exists(isAssignableTo(Collection.class))
                || genericType.exists(isEqualTo(Object.class))) {
            collection.add(jedis.zrange(key, 0, -1));
        } else {
            collection.addAll(jedis.zrange(key, 0, -1));
        }
    }
        break;
    }
    return collection;
}

From source file:com.newatlanta.appengine.vfs.provider.GaeFileSystem.java

@SuppressWarnings("unchecked")
protected void addCapabilities(Collection capabilities) {
    capabilities.addAll(GaeFileProvider.capabilities);
}

From source file:com.thinkberg.moxo.vfs.s3.jets3t.Jets3tFileSystem.java

@SuppressWarnings({ "unchecked" })
protected void addCapabilities(Collection caps) {
    caps.addAll(S3FileProvider.capabilities);
}

From source file:com.adito.networkplaces.vfs2.provider.smb.SmbFileSystem.java

/**
 * Returns the capabilities of this file system.
 *///from w  w  w .  j ava 2s  . c o  m
protected void addCapabilities(final Collection<Capability> capabilities) {
    capabilities.addAll(SmbFileProvider.capabilities);
}

From source file:com.sludev.commons.vfs2.provider.azure.AzFileSystem.java

@Override
protected void addCapabilities(Collection<Capability> caps) {
    caps.addAll(AzFileProvider.capabilities);
}

From source file:com.sludev.commons.vfs2.provider.s3.SS3FileSystem.java

@Override
protected void addCapabilities(Collection<Capability> caps) {
    caps.addAll(SS3FileProvider.capabilities);
}

From source file:com.jaspersoft.jasperserver.api.metadata.common.util.RepositoryFileSystem.java

/**
 * Returns the capabilities of this file system.
 * @param caps VFS capabilities collection
 *///www  . jav  a2s  .c  o m
protected void addCapabilities(final Collection caps) {
    caps.addAll(RepositoryFileProvider.capabilities);
}