Example usage for java.util Collection add

List of usage examples for java.util Collection add

Introduction

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

Prototype

boolean add(E e);

Source Link

Document

Ensures that this collection contains the specified element (optional operation).

Usage

From source file:com.github.jinahya.io.bit.BitIoTests.java

static int valueInt(final Collection<Integer> lengths) {

    final int length = lengthInt();
    lengths.add(length);

    return valueInt(length);
}

From source file:com.glaf.core.util.AnnotationUtils.java

public static Collection<String> findMapper(String packagePrefix) {
    AnnotationDB db = getAnnotationDB(packagePrefix);
    Map<String, Set<String>> annotationIndex = db.getAnnotationIndex();
    Set<String> entities = annotationIndex.get("org.springframework.stereotype.Component");
    Collection<String> sortSet = new TreeSet<String>();
    if (entities != null && !entities.isEmpty()) {
        for (String str : entities) {
            if (packagePrefix != null && str.contains(packagePrefix) && StringUtils.contains(str, ".mapper.")) {
                sortSet.add(str);
            }//from  w  ww  .j a  v  a  2 s .  c  o m
        }
    }
    return sortSet;
}

From source file:com.google.appengine.tools.mapreduce.impl.ShardStateEntity.java

public static <K, V, OK, OV> void deleteAllShards(Iterable<ShardStateEntity<K, V, OK, OV>> shardStates) {
    Collection<Key> keys = new ArrayList<Key>();
    for (ShardStateEntity<K, V, OK, OV> shardState : shardStates) {
        keys.add(shardState.entity.getKey());
    }//from  ww w .  j  a v  a  2  s  .c o m
    getDatastoreService().delete(keys);
}

From source file:org.calrissian.restdoclet.writer.swagger.SwaggerWriter.java

private static void writeApi(String resource, Collection<Endpoint> endpoints, Configuration config)
        throws IOException {
    Map<String, Collection<Endpoint>> pathGroups = groupPaths(endpoints);

    File apiFile = new File("./" + API_DOC_DIR, resource);
    apiFile.getParentFile().mkdirs();/*from w  ww  .  j  a va2s  . c om*/

    Collection<Api> apis = new ArrayList<Api>(pathGroups.size());
    for (Entry<String, Collection<Endpoint>> entry : pathGroups.entrySet())
        apis.add(new Api(entry.getKey(), "", getOperations(entry.getValue())));

    mapper.writerWithDefaultPrettyPrinter().writeValue(new FileOutputStream(apiFile),
            new ApiListing(SWAGGER_VERSION, config.getUrl(), resource, config.getApiVersion(), apis));
}

From source file:com.github.jinahya.io.bit.BitIoTests.java

static long valueLong(final Collection<Integer> lengths) {

    final int length = lengthLong();
    lengths.add(length);

    return valueLong(lengths);
}

From source file:Main.java

static public int findAllDescendantElements(Node e, String qname, Collection vector) {
    int n = 0;/*from   w  w  w  .  jav a2s  . c  o  m*/
    if (e == null || qname == null)
        return 0;
    for (Node c = e.getFirstChild(); c != null; c = c.getNextSibling()) {
        if (c.getNodeType() == Node.ELEMENT_NODE && c.getNodeName().equals(qname)) {
            ++n;
            vector.add((Element) c);
        }
        n += findAllDescendantElements(c, qname, vector);
    }
    return n;
}

From source file:io.udvi.amqp.mq.transport.connection.CAMQPConnectionManager.java

static Collection<String> listConnections() {
    Collection<String> connectionList = new ArrayList<>();
    Set<CAMQPConnectionKey> keys = openConnections.keySet();
    for (CAMQPConnectionKey k : keys) {
        connectionList.add(k.toString());
    }//from   w  ww.j  a v  a2 s. c om
    return connectionList;
}

From source file:org.eclipse.lyo.testsuite.oslcv2.ServiceProviderCatalogRdfXmlTests.java

public static Collection<Object[]> getReferencedCatalogUrlsUsingRdfXml(String base)
        throws IOException, ParserConfigurationException, SAXException, XPathException {
    staticSetup();/*from   w  w w .j  a v a2  s.co  m*/
    HttpResponse resp = OSLCUtils.getResponseFromUrl(base, base, basicCreds, OSLCConstants.CT_RDF, headers);

    assertEquals("Did not successfully retrieve catalog at: " + base, HttpStatus.SC_OK,
            resp.getStatusLine().getStatusCode());

    // ArrayList to contain the urls from all SPCs
    Collection<Object[]> data = new ArrayList<Object[]>();
    // Add ourself (base)
    data.add(new Object[] { base });

    Model rdfModel = ModelFactory.createDefaultModel();
    rdfModel.read(resp.getEntity().getContent(), base, OSLCConstants.JENA_RDF_XML);
    RDFUtils.validateModel(rdfModel);

    Property catPredicate = rdfModel.createProperty(OSLCConstants.SERVICE_PROVIDER_CATALOG_PROP);
    Selector select = new SimpleSelector(null, catPredicate, (RDFNode) null);
    StmtIterator listStatements = rdfModel.listStatements(select);
    while (listStatements.hasNext()) {
        data.add(new Object[] { listStatements.nextStatement().getObject().toString() });
    }

    return data;
}

From source file:com.google.appengine.tools.mapreduce.impl.ShardStateEntity.java

/**
 * Gets all shard states corresponding to a particular Job ID
 *///from   w  w w  . j  a  v a 2 s  .  c  om
public static <K, V, OK, OV> List<ShardStateEntity<K, V, OK, OV>> getShardStates(
        MapperStateEntity<K, V, OK, OV> mapperState) {
    Collection<Key> keys = new ArrayList<Key>();
    for (int i = 0; i < mapperState.getShardCount(); ++i) {
        keys.add(createKey(mapperState.getJobID(), i));
    }

    Map<Key, Entity> map = getDatastoreService().get(keys);
    List<ShardStateEntity<K, V, OK, OV>> shardStates = new ArrayList<ShardStateEntity<K, V, OK, OV>>(
            map.size());
    for (Key key : keys) {
        Entity entity = map.get(key);
        if (entity != null) {
            ShardStateEntity<K, V, OK, OV> shardState = new ShardStateEntity<K, V, OK, OV>(entity);
            shardStates.add(shardState);
        }
    }
    return shardStates;
}

From source file:com.qrmedia.commons.test.annotation.processing.AbstractAnnotationProcessorTest.java

private static Collection<File> findClasspathFiles(String[] filenames) throws IOException {
    Collection<File> classpathFiles = new ArrayList<File>(filenames.length);

    for (String filename : filenames) {
        classpathFiles.add(new ClassPathResource(filename).getFile());
    }/*from   ww w  .j a v a  2  s  .c o  m*/

    return classpathFiles;
}