List of usage examples for java.util Collection addAll
boolean addAll(Collection<? extends E> c);
From source file:com.datos.vfs.provider.tar.TarFileSystem.java
/** * Returns the capabilities of this file system. *//*w w w .ja v a2 s . co m*/ @Override protected void addCapabilities(final Collection<Capability> caps) { caps.addAll(TarFileProvider.capabilities); }
From source file:eu.java.pg.jsonb.types.JSONBUserType.java
@SuppressWarnings("unchecked") @Override/*from w ww .j a va 2 s . co m*/ public Object deepCopy(Object value) throws HibernateException { if (!(value instanceof Collection)) { return value; } Collection<?> collection = (Collection) value; Collection collectionClone = CollectionFactory.newInstance(collection.getClass()); collectionClone.addAll(collection.stream().map(this::deepCopy).collect(Collectors.toList())); return collectionClone; }
From source file:com.smash.revolance.ui.comparator.element.ElementMatchMaker.java
@Override public Collection<ElementMatch> findMatch(Collection<ElementBean> elements, ElementBean element, ElementSearchMethod... methods) throws NoMatchFound, IllegalArgumentException { if (elements == null) { throw new IllegalArgumentException("Null content cannot be parsed"); }// w w w .j a va 2 s . c om if (element == null) { throw new IllegalArgumentException("Null element cannot be matched."); } if (elements.isEmpty()) { throw new NoMatchFound("Unable to find a single match. Empty element collection passed in."); } Collection<ElementBean> localElements = new ArrayList<ElementBean>(); localElements.addAll(elements); if (localElements.contains(element)) { localElements.remove(element); } List<ElementMatch> matches = getElementMatches(element, localElements, methods); if (matches.isEmpty()) { throw new NoMatchFound("Unable to find a single match."); } else { return matches; } }
From source file:cn.guoyukun.spring.jpa.repository.hibernate.type.CollectionToStringUserType.java
/** * ???//from w w w . j a v a2 s .c om * * nullSafeGet????? * deepCopy???? * ?? * deepCopy?Hibernate? * ??????Hibernate??? * equals???equalsfalse?? * * @param o * @return * @throws org.hibernate.HibernateException */ @Override public Object deepCopy(Object o) throws HibernateException { if (o == null) return null; Collection copyCollection = newCollection(); copyCollection.addAll((Collection) o); return copyCollection; }
From source file:functionaltests.TestXMLTransformer.java
@org.junit.Test public void run() throws Throwable { File folder = new File(jobDescriptorsFolder.toURI()); File[] testJobDescrFiles = folder.listFiles(); File samplesJobDescrFiles = new File(System.getProperty("pa.scheduler.home") + File.separator + "samples" + File.separator + "jobs_descriptors"); System.out.println(samplesJobDescrFiles.getAbsolutePath()); Collection<File> samples = FileUtils.listFiles(samplesJobDescrFiles, new String[] { "xml" }, true); samples.addAll(Arrays.asList(testJobDescrFiles)); System.out.println("Treating " + samples.size() + " job descriptors."); for (File file : samples) { try {//from w ww .j a va2s.co m transformAndCompare(file); } catch (Exception e) { throw new Exception("An exception occured while treating the file " + file.getAbsolutePath(), e); } } }
From source file:net.ontopia.topicmaps.query.parser.NotClause.java
@Override public Collection getAllVariables() { Collection vars = new HashSet(); for (int ix = 0; ix < clauses.size(); ix++) { AbstractClause clause = (AbstractClause) clauses.get(ix); vars.addAll(clause.getAllVariables()); }// ww w . j a va 2s . c om return vars; }
From source file:chibi.gemmaanalysis.GeneExpressionProfileWriterCLI.java
@Override protected Exception doWork(String[] args) { processCommandLine(args);//from w ww . j a va 2 s .co m Collection<Gene> genes; try { genes = getQueryGenes(); } catch (IOException e) { return e; } FilterConfig filterConfig = new FilterConfig(); for (BioAssaySet bas : this.expressionExperiments) { ExpressionExperiment ee = (ExpressionExperiment) bas; Collection<ArrayDesign> ads = eeService.getArrayDesignsUsed(ee); Collection<CompositeSequence> css = new HashSet<CompositeSequence>(); for (ArrayDesign ad : ads) { css.addAll(adService.getCompositeSequences(ad)); } Map<Gene, Collection<CompositeSequence>> gene2css = coexpAnalysisService.getGene2CsMap(css); ExpressionDataDoubleMatrix dataMatrix = coexpAnalysisService.getExpressionDataMatrix(ee, filterConfig); String fileName = outFilePrefix + "." + ee.getShortName() + ".txt"; try (PrintWriter out = new PrintWriter(new FileWriter(fileName));) { for (Gene gene : genes) { Collection<CompositeSequence> c = gene2css.get(gene); for (CompositeSequence cs : c) { Double[] row = dataMatrix.getRow(cs); if (row == null) { log.error("Cannot get data from data matrix for " + gene.getOfficialSymbol() + " (" + cs.getName() + ")"); continue; } StringBuffer buf = new StringBuffer(); buf.append(gene.getOfficialSymbol() + "\t" + cs.getName() + "\t"); for (Double d : row) { if (d == null) buf.append("NaN"); else buf.append(d); buf.append("\t"); } buf.deleteCharAt(buf.length() - 1); out.println(buf.toString()); } } } catch (IOException e) { return e; } } return null; }
From source file:net.ontopia.topicmaps.query.parser.NotClause.java
@Override public List getArguments() { Collection items = new HashSet(); for (int ix = 0; ix < clauses.size(); ix++) { AbstractClause clause = (AbstractClause) clauses.get(ix); items.addAll(clause.getArguments()); }/*from w ww. ja v a 2 s . c o m*/ List list = new ArrayList(); list.addAll(items); return list; }
From source file:com.sworddance.util.CUtilities.java
@SuppressWarnings("unchecked") public static <T extends Collection<?>> T cloneCollection(T cloned) { Collection result = null; if (cloned != null) { try {/*from ww w . j ava 2s .c om*/ result = cloned.getClass().newInstance(); } catch (InstantiationException e) { throw new ApplicationGeneralException(e); } catch (IllegalAccessException e) { throw new ApplicationGeneralException(e); } result.addAll(cloned); } return (T) result; }
From source file:net.ontopia.topicmaps.query.parser.NotClause.java
@Override public Collection getAllLiterals() { Collection literals = new HashSet(); for (int ix = 0; ix < clauses.size(); ix++) { AbstractClause clause = (AbstractClause) clauses.get(ix); literals.addAll(clause.getAllLiterals()); }//from w ww . jav a 2 s . c o m return literals; }