Example usage for java.util ArrayList addAll

List of usage examples for java.util ArrayList addAll

Introduction

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

Prototype

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

Source Link

Document

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.

Usage

From source file:com.iggroup.oss.restdoclet.doclet.type.Services.java

/**
 * Gets a sorted list of all controllers' services.
 * //from   www  .j  a va 2s  .  com
 * @return the sorted list of all controllers' services .
 */
public Collection<Service> getServices() {
    ArrayList<Service> services = new ArrayList<Service>();
    for (ControllerSummary controller : controllers) {
        services.addAll(controller.getServices());
    }
    Collections.sort(services);

    return services;
}

From source file:de.kaiserpfalzEdv.iam.core.identity.SubjectDO.java

@Override
public List<RoleDO> getRoles() {
    ArrayList<RoleDO> result = new ArrayList<>();

    for (RoleDO r : roles) {
        result.addAll(convertToRoleDO(r.getRoles()));
    }/* ww w. j a v a2 s . co  m*/

    return result;
}

From source file:jsentvar.SubstitutionTest.java

/**
 * Test of oneTerm method, of class Substitution.
 *//*  w  w w  . j a  v a  2s.c  o m*/
@Test
public void testOneTerm() throws IOException {
    System.out.println("Substitution.oneTerm() Test");
    RDFReader lector = new RDFReader();
    String filename;
    //filename = "resources/test/miniReasoner.owl";
    filename = "resources/IEEE_reasoner20022016.owl";
    Model model;
    //String term_value = term_value0.substring(0, 1).toUpperCase() +term_value0.substring(1);

    model = lector.reader(filename);

    //Read positions, a json file
    String possFile = "resources/test/text_doc0.json";
    JsonReader jreader = new JsonReader();
    HashMap<String, HashMap<Integer, Integer>> poss = jreader.reader(possFile);
    /*
    try {
    System.out.println(poss.toString());
    } catch (NullPointerException e) {
    System.out.println("ERROR showing results " + e);
    }
    */
    ArrayList<String> terms1 = new ArrayList<>();

    Set originS = poss.keySet();
    terms1.addAll(originS);

    //Get all the terms for substitution
    /*
    ArrayList<String> terms0 = new ArrayList<>();
            terms0.add("military satellites");
            terms0.add("intelligent_systems");
    */
    Surrogate sur = new Surrogate(model);
    HashMap<String, ArrayList<String>> alternatives;
    Utils utils = new Utils();
    ArrayList<String> terms = utils.firstUpperForeach(terms1);
    alternatives = sur.surrogatesForeach(terms);
    //System.out.println(alternatives.toString());

    String docFile = "resources/test/tex_doc0.txt";
    String doc = FileUtils.readFileToString(new File(docFile), "utf8");
    Substitution gen = new Substitution();
    HashSet newDocs = new HashSet();
    for (String term : terms) {
        System.out.println(term);
        HashSet newDocs0 = gen.oneTerm(doc, term, alternatives.get(term));
        newDocs.addAll(newDocs0);
    }

    String expResult = FileUtils.readFileToString(new File("resources/test/substitutionOneTermResult.txt"),
            "utf8");
    assertEquals(expResult, newDocs.toString());

}

From source file:eu.stratosphere.api.common.operators.util.FieldList.java

@Override
public FieldList addField(Integer fieldID) {
    if (fieldID == null) {
        throw new IllegalArgumentException("Field ID must not be null.");
    }/*  w ww.j  a  va 2s.  c o m*/

    if (size() == 0) {
        return new FieldList(fieldID);
    } else {
        ArrayList<Integer> list = new ArrayList<Integer>(size() + 1);
        list.addAll(this.collection);
        list.add(fieldID);
        return new FieldList(Collections.unmodifiableList(list));
    }
}

From source file:com.tassadar.multirommgr.installfragment.UbuntuChannel.java

public void fillInstallFilesForVer(ArrayList<UbuntuFile> files, Integer version) {
    UbuntuImage img = m_images.get(version);
    files.addAll(img.files);
}

From source file:sernet.gs.ui.rcp.main.bsi.views.chart.ISRSpiderChart.java

/**
 * @param entrySet//from w w  w .j a  v a  2 s.  c  om
 * @return
 */
private List<Entry<String, Double>> sort(Set<Entry<String, Double>> entrySet) {
    ArrayList<Entry<String, Double>> list = new ArrayList<Entry<String, Double>>();
    list.addAll(entrySet);
    Collections.sort(list, new Comparator<Entry<String, Double>>() {
        public int compare(Entry<String, Double> o1, Entry<String, Double> o2) {
            return o1.getKey().compareTo(o2.getKey());
        }
    });
    return list;
}

From source file:be.neutrinet.ispng.vpn.api.VPNClientConfig.java

@Get
public Representation getPKCS11Config() {
    if (getQueryValue("user") != null && getQueryValue("platform") != null) {
        String userId = getQueryValue("user");
        String platform = getQueryValue("platform");

        try {/*from   w  w w . ja va2s.c om*/
            User user = Users.dao.queryForId(userId);
            if (user.certId == null)
                return clientError("NO_KEYPAIR", Status.CLIENT_ERROR_FAILED_DEPENDENCY);

            ArrayList<String> config = new ArrayList<>();
            config.addAll(Arrays.asList(DEFAULTS));

            // create zip
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            ZipOutputStream zip = new ZipOutputStream(baos);

            Representation res = addPKCS11config(platform.toLowerCase(), config, user);
            if (res != null)
                return res;

            return finalizeZip(config, zip, baos);
        } catch (Exception ex) {
            Logger.getLogger(getClass()).debug("Failed to build PKCS11 config for user " + userId, ex);
        }
    }

    return clientError("INVALID_REQUEST", Status.CLIENT_ERROR_BAD_REQUEST);
}

From source file:ch.unibas.fittingwizard.infrastructure.base.VmdRunner.java

private void setCommand(List<String> args, File outputFile) {

    ArrayList<String> list = new ArrayList<>();
    list.add(ExecutableName);//from   w ww  .j  a  v a2s  . c om

    if (!args.isEmpty()) {
        list.addAll(args);
    }

    pb.command(list);
    if (logger.isDebugEnabled()) {
        logger.debug("ProcessBuilder.command = " + StringUtils.join(pb.command(), " "));
    }

    if (outputFile != null) {
        logger.debug("redirectOutput set to " + FilenameUtils.normalize(outputFile.getAbsolutePath()));
        pb.redirectOutput(outputFile);
    } else {
        logger.debug("redirectOutput set to inheritIO");
        pb.inheritIO();
    }
}

From source file:com.github.signed.sandboxes.maven.MyMojo.java

private ArrayList<ArtifactRepository> repositoriesToSearchForArtifacts() {
    ArrayList<ArtifactRepository> repoList = new ArrayList<ArtifactRepository>();
    if (pomRemoteRepositories != null) {
        repoList.addAll(pomRemoteRepositories);
    }//from w  ww . j av a 2 s  .  c o  m
    return repoList;
}

From source file:jsentvar.GenerateTestsResults.java

public void substitutionOneTermResult() throws IOException {
    RDFReader lector = new RDFReader();
    String filename;/*w ww.j a  v  a2  s  . co  m*/
    //filename = "resources/test/miniReasoner.owl";
    filename = "resources/IEEE_reasoner20022016.owl";
    //String term_value = term_value0.substring(0, 1).toUpperCase() +term_value0.substring(1);

    model = lector.reader(filename);

    //Read positions, a json file
    String possFile = "resources/test/text_doc0.json";
    JsonReader jreader = new JsonReader();
    HashMap<String, HashMap<Integer, Integer>> poss = jreader.reader(possFile);
    ArrayList<String> terms1 = new ArrayList<>();

    Set originS = poss.keySet();
    terms1.addAll(originS);

    //Get all the terms for substitution
    Surrogate sur = new Surrogate(model);
    HashMap<String, ArrayList<String>> alternatives;
    Utils utils = new Utils();
    ArrayList<String> terms = utils.firstUpperForeach(terms1);
    alternatives = sur.surrogatesForeach(terms);
    String docFile = "resources/tex_doc0.txt";
    String doc = FileUtils.readFileToString(new File(docFile), "utf8");
    Substitution gen = new Substitution();
    HashSet newDocs = new HashSet();
    for (String term : terms) {
        //System.out.println(term);
        HashSet newDocs0 = gen.oneTerm(doc, term, alternatives.get(term));
        newDocs.addAll(newDocs0);
    }
    FileUtils.writeStringToFile(new File("resources/test/substitutionOneTermResult.txt"), newDocs.toString(),
            "utf8");

}