List of usage examples for java.util ArrayList addAll
public boolean addAll(Collection<? extends E> c)
From source file:com.thoughtworks.go.server.GoServer.java
private String getExtraJarsToBeAddedToClasspath() { ArrayList<File> extraClassPathFiles = new ArrayList<>(); extraClassPathFiles.addAll(getAddonJarFiles()); String extraClasspath = convertToClasspath(extraClassPathFiles); LOG.info("Including addons: {}", extraClasspath); return extraClasspath; }
From source file:hrpod.tools.nlp.StopWordRemoval.java
public ArrayList<String> removeStopWords(String[] words) { String newText = null;/* www .j a v a 2 s .c o m*/ ArrayList<String> wordList = new ArrayList(); wordList.addAll(Arrays.asList(words)); //find stop/common words and remove them for (int w = 0; w < wordList.size(); w++) { String word = wordList.get(w); //break phrases down into individaul words ArrayList<String> subWordList = new ArrayList(); subWordList.addAll(Arrays.asList(wordList.get(w).split(" "))); //remove the stop words for (int swl = 0; swl < subWordList.size(); swl++) { for (int sw = 0; sw < stopWords.length; sw++) { String stopWord = stopWords[sw]; if (stopWords[sw].toLowerCase().contains(subWordList.get(swl).toLowerCase())) { //logger.info("REMOVE WORD: " + stopWords[sw]); subWordList.remove(swl); swl--; break; } } } wordList.set(w, StringUtils.join(subWordList, " ")); if (wordList.get(w).trim().equals("")) { wordList.remove(w); w--; } } //newText = StringUtils.join(wordList, " "); return wordList; }
From source file:it.iit.genomics.cru.structures.bridges.bridges.UniprotkbUtilsTest.java
public void testVarSplice() throws BridgesRemoteAccessException { String uniprotAc = "O14746"; String[] uniprotAcs = { uniprotAc }; ArrayList<String> uniprotAcsCollection = new ArrayList<>(); uniprotAcsCollection.addAll(Arrays.asList(uniprotAcs)); HashMap<String, MoleculeEntry> entries = UniprotkbUtils.getInstance("9606") .getUniprotEntriesFromUniprotAccessions(uniprotAcsCollection); System.out.println(entries.get(uniprotAc).getVarSpliceAC("NM_198253")); //System.out.println(entries.get(uniprotAc).getVarSpliceAC("NM_001145339.2")); HashSet<String> geneIds = new HashSet<>(); geneIds.addAll(entries.get(uniprotAc).getGeneNames()); geneIds.addAll(entries.get(uniprotAc).getRefseqs()); geneIds.addAll(entries.get(uniprotAc).getEnsemblGenes()); System.out.println("GeneIds: " + StringUtils.join(geneIds, ", ")); System.out.println(entries.get(uniprotAc).getVarSpliceAC("NM_198253")); System.out.println(entries.get(uniprotAc).getSequence("NM_198253")); Assert.assertEquals(uniprotAc, entries.get(uniprotAc).getVarSpliceAC("NM_198253")); Assert.assertEquals(uniprotAc, entries.get(uniprotAc).getSequence("NM_198253").getSequence()); }
From source file:com.microsoft.tfs.core.httpclient.params.DefaultHttpParamsFactory.java
protected HttpParams createParams() { final HttpClientParams params = new HttpClientParams(null); params.setParameter(HttpMethodParams.USER_AGENT, "Jakarta Commons-HttpClient/3.1"); params.setVersion(HttpVersion.HTTP_1_1); params.setConnectionManagerClass(SimpleHttpConnectionManager.class); params.setCookiePolicy(CookiePolicy.DEFAULT); params.setHttpElementCharset("US-ASCII"); params.setContentCharset("ISO-8859-1"); params.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler()); final ArrayList datePatterns = new ArrayList(); datePatterns.addAll(Arrays.asList(new String[] { DateUtil.PATTERN_RFC1123, DateUtil.PATTERN_RFC1036, DateUtil.PATTERN_ASCTIME, "EEE, dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MMM-yyyy HH-mm-ss z", "EEE, dd MMM yy HH:mm:ss z", "EEE dd-MMM-yyyy HH:mm:ss z", "EEE dd MMM yyyy HH:mm:ss z", "EEE dd-MMM-yyyy HH-mm-ss z", "EEE dd-MMM-yy HH:mm:ss z", "EEE dd MMM yy HH:mm:ss z", "EEE,dd-MMM-yy HH:mm:ss z", "EEE,dd-MMM-yyyy HH:mm:ss z", "EEE, dd-MM-yyyy HH:mm:ss z", })); params.setParameter(HttpMethodParams.DATE_PATTERNS, datePatterns); // TODO: To be removed. Provided for backward compatibility String agent = null;/*from www . j a v a2 s. c o m*/ try { agent = System.getProperty("httpclient.useragent"); } catch (final SecurityException ignore) { } if (agent != null) { params.setParameter(HttpMethodParams.USER_AGENT, agent); } // TODO: To be removed. Provided for backward compatibility String defaultCookiePolicy = null; try { defaultCookiePolicy = System.getProperty("apache.commons.httpclient.cookiespec"); } catch (final SecurityException ignore) { } if (defaultCookiePolicy != null) { if ("COMPATIBILITY".equalsIgnoreCase(defaultCookiePolicy)) { params.setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); } else if ("NETSCAPE_DRAFT".equalsIgnoreCase(defaultCookiePolicy)) { params.setCookiePolicy(CookiePolicy.NETSCAPE); } else if ("RFC2109".equalsIgnoreCase(defaultCookiePolicy)) { params.setCookiePolicy(CookiePolicy.RFC_2109); } } return params; }
From source file:com.glluch.profilesparser.ICTProfile.java
/** * Get the terms asociated with a profile without its counts. * @return the asociated terms./*from ww w. ja v a 2 s.c o m*/ */ public ArrayList<String> onlyTerms() { ArrayList<String> res = new ArrayList<>(); res.addAll(pterms.keySet()); return res; }
From source file:io.gatling.mojo.Fork.java
private List<String> buildCommand() throws IOException { ArrayList<String> command = new ArrayList<String>(jvmArgs.size() + 2); command.addAll(jvmArgs); command.add(mainClassName);//ww w . j av a2s . c om command.add(createArgFile(args).getCanonicalPath()); return command; }
From source file:net.landora.video.programs.ProgramsAddon.java
public boolean isAvaliable(Program program) { String path = getConfiguredPath(program); if (path == null) { return false; }//from w w w .j a va 2s.c om ArrayList<String> command = new ArrayList<String>(); command.add(path); command.addAll(program.getTestArguments()); ProcessBuilder builder = new ProcessBuilder(command); builder.redirectErrorStream(true); try { Process p = builder.start(); IOUtils.copy(p.getInputStream(), new NullOutputStream()); p.waitFor(); return true; } catch (Exception e) { log.info("Error checking for program: " + program, e); return false; } }
From source file:org.apache.activemq.apollo.dto.ApolloTypeIdResolver.java
public void init(JavaType baseType) { this.baseType = baseType; ArrayList<Class<?>> classes = new ArrayList<Class<?>>(); classes.add(baseType.getRawClass()); classes.addAll(Arrays.asList(DtoModules.extensionClasses())); for (Class<?> c : classes) { if (baseType.getRawClass().isAssignableFrom(c)) { JsonTypeName jsonAnnoation = c.getAnnotation(JsonTypeName.class); if (jsonAnnoation != null && jsonAnnoation.value() != null) { typeToId.put(c, jsonAnnoation.value()); idToType.put(jsonAnnoation.value(), TypeFactory.defaultInstance().constructSpecializedType(baseType, c)); idToType.put(c.getName(), TypeFactory.defaultInstance().constructSpecializedType(baseType, c)); } else { XmlRootElement xmlAnnoation = c.getAnnotation(XmlRootElement.class); if (xmlAnnoation != null && xmlAnnoation.name() != null) { typeToId.put(c, xmlAnnoation.name()); idToType.put(xmlAnnoation.name(), TypeFactory.defaultInstance().constructSpecializedType(baseType, c)); idToType.put(c.getName(), TypeFactory.defaultInstance().constructSpecializedType(baseType, c)); }//from w ww . j a va 2 s .co m } } } }
From source file:br.unicamp.cst.motivational.MotivationalMonitor.java
@Override public synchronized void run() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); final JFreeChart chart = ChartFactory.createBarChart(getTitle(), getEntity(), "Value", dataset, PlotOrientation.VERTICAL, true, true, false); final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); chart.setBackgroundPaint(Color.lightGray); ChartFrame frame = new ChartFrame(getTitle(), chart); frame.pack();/*from ww w . j a v a2 s. co m*/ frame.setVisible(true); while (true) { ArrayList<Codelet> tempCodeletsList = new ArrayList<Codelet>(); tempCodeletsList.addAll(this.getListOfMotivationalEntities()); synchronized (tempCodeletsList) { for (Codelet co : tempCodeletsList) { dataset.addValue(co.getActivation(), co.getName(), "activation"); } try { Thread.currentThread().sleep(getRefreshPeriod()); } catch (InterruptedException e) { e.printStackTrace(); } } } }
From source file:io.pivio.dependencies.DependenciesReaderTest.java
@Test public void testReadLicensesCombined() throws Exception { ArrayList<Dependency> resultFe = new ArrayList<>(); resultFe.add(new Dependency("fe_dependency", "testurl", new ArrayList())); ArrayList<Dependency> resultBe = new ArrayList<>(); resultBe.add(new Dependency("be_dependency_1", "testurl", new ArrayList())); resultBe.add(new Dependency("be_dependency_2", "testurl", new ArrayList())); dependenciesReader.configuration/*from w ww .java 2s . co m*/ .setParameter(generateCommandLineWithMultipleSourcesAndRelativeSourceCodeSwitch()); when(mockedBuildTool.getDependencyReader(new File("/tmp/frontend/src"))).thenReturn(mockedDependencyReader); when(mockedDependencyReader.readDependencies("/tmp/frontend/src")).thenReturn(resultFe); when(mockedBuildTool.getDependencyReader(new File("/tmp/backend/src"))).thenReturn(mockedDependencyReader); when(mockedDependencyReader.readDependencies("/tmp/backend/src")).thenReturn(resultBe); List<Dependency> dependencies = dependenciesReader.getDependencies(); ArrayList<Dependency> expectedResult = new ArrayList<>(); expectedResult.addAll(resultFe); expectedResult.addAll(resultBe); verify(mockedDependencyReader, times(2)).readDependencies(anyString()); assertThat(dependencies).isEqualTo(expectedResult); }