List of usage examples for java.util List addAll
boolean addAll(Collection<? extends E> c);
From source file:Utils.java
public static List<Component> getAllComponents(final Container c) { Component[] comps = c.getComponents(); List<Component> compList = new ArrayList<Component>(); for (Component comp : comps) { compList.add(comp);// ww w . ja v a 2 s.co m if (comp instanceof Container) { compList.addAll(getAllComponents((Container) comp)); } } return compList; }
From source file:$.Collections3.java
/** * a+bList./*from w ww . j a va 2 s. co m*/ */ public static <T> List<T> union(final Collection<T> a, final Collection<T> b) { List<T> result = new ArrayList<T>(a); result.addAll(b); return result; }
From source file:Main.java
public static void getBJ() { List<Integer> l1 = new ArrayList<Integer>(); l1.add(1);/*w w w . java2s . c om*/ l1.add(2); l1.add(3); l1.add(4); List<Integer> l = new ArrayList<Integer>(); for (Integer item : l1) { if (item == 2 || item == 7) { l.add(item); } } l1.removeAll(l); l.addAll(l1); System.out.println(l); }
From source file:cz.cuni.mff.ksi.jinfer.attrstats.JFCWrapper.java
/** * Creates a {@link JPanel} containing a pie chart describing the content of * the provided {@link Attribute}s./* w w w .j a v a2 s . c om*/ * * @param nodes List of attribute nodes to display. * @return Panel containing the requested graph. */ public static JPanel createGraphPanel(final List<AttributeTreeNode> nodes) { final List<String> content = new ArrayList<String>(); for (final AttributeTreeNode atn : nodes) { content.addAll(atn.getContent()); } return createGraphPanel(getChartTitle(nodes), content); }
From source file:com.github.blindpirate.gogradle.util.CollectionUtils.java
public static List<String> asStringList(Object... elements) { List<String> ret = new ArrayList<>(); Stream.of(elements).forEach(element -> { if (element instanceof Collection) { ret.addAll((Collection) element); } else if (element != null && element.getClass().isArray()) { Stream.of((String[]) element).forEach(ret::add); } else {// w w w . j a v a 2 s. c o m ret.add((String) element); } }); return ret; }
From source file:Main.java
public static <T> List<T> ToList(Collection<List<T>> values) { List<T> alllist = new ArrayList<T>(); Iterator<List<T>> iterator = values.iterator(); List<T> list = null;/*from www .j a va2s. c o m*/ while (iterator.hasNext()) { list = (List<T>) iterator.next(); alllist.addAll(list); } return alllist; }
From source file:dhbw.clippinggorilla.external.twitter.TwitterUtils.java
/** * @param includedTagsSet//from w w w . j av a 2 s .c o m * @param date * @return */ private static Query queryBuilder(Set<String> includedTagsSet, LocalDateTime date) { List<String> includedTags = new ArrayList<>(); includedTags.addAll(includedTagsSet); String query = ""; if (includedTags.size() > 0) { query = replaceWhitespaces(includedTags.get(0)); for (int i = 1; i < includedTags.size(); i++) { query += " OR " + replaceWhitespaces(includedTags.get(i)); } } //System.out.println(date.toString()); //System.out.println(query); Query result = new Query(query); result.setResultType(Query.ResultType.popular); result.setSince(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); return result; }
From source file:com.ephesoft.gxt.batchinstance.client.shared.BatchInstanceProgressConvertor.java
public static final WorkflowDetailDTO getWorkflowDetailDTO(final WorkflowDetail workflowDetail, final String batchInstanceIdentifier) { WorkflowDetailDTO workflowDetailDTO = new WorkflowDetailDTO(); if (null != workflowDetail) { workflowDetailDTO.setCurrentExecutingModule(workflowDetail.getCurrentExecutingModule()); workflowDetailDTO.setCurrentExecutingPlugin(workflowDetail.getCurrentExecutingPlugin()); List<String> executedModules = workflowDetail.getExecutedModuleList(); if (CollectionUtils.isNotEmpty(executedModules)) { List<String> executedModuleDTOList = new ArrayList<String>(executedModules.size()); executedModuleDTOList.addAll(executedModules); workflowDetailDTO.setExecutedModuleList(executedModuleDTOList); LOGGER.debug("Executed modules are set for batch instance: ", batchInstanceIdentifier); }//from ww w . ja v a2 s . co m List<String> unexecutedModules = workflowDetail.getUnexecutedModuleList(); if (CollectionUtils.isNotEmpty(unexecutedModules)) { List<String> unexecutedModuleDTOList = new ArrayList<String>(unexecutedModules.size()); unexecutedModuleDTOList.addAll(unexecutedModules); workflowDetailDTO.setNonExecutedModuleList(unexecutedModuleDTOList); LOGGER.debug("Unexecuted modules are set for batch instance: ", batchInstanceIdentifier); } List<String> executedPlugins = workflowDetail.getExecutedPluginList(); if (CollectionUtils.isNotEmpty(executedPlugins)) { List<String> executedPluginDTOList = new ArrayList<String>(executedPlugins.size()); executedPluginDTOList.addAll(executedPlugins); workflowDetailDTO.setExecutedPluginList(executedPluginDTOList); LOGGER.debug("Executed plugins are set for batch instance: ", batchInstanceIdentifier); } List<String> unexecutedPlugins = workflowDetail.getUnexecutedPluginList(); if (CollectionUtils.isNotEmpty(unexecutedPlugins)) { List<String> unexecutedPluginDTOList = new ArrayList<String>(unexecutedPlugins.size()); unexecutedPluginDTOList.addAll(unexecutedPlugins); workflowDetailDTO.setNonExecutedPluginList(unexecutedPluginDTOList); LOGGER.debug("Unexecuted plugins are set for batch instance: ", batchInstanceIdentifier); } Map<String, List<String>> modulePluginMap = workflowDetail.getModulePluginMap(); if (null != modulePluginMap) { Map<String, List<String>> modulePluginMapDTO = new HashMap<String, List<String>>( modulePluginMap.size()); modulePluginMapDTO.putAll(modulePluginMap); workflowDetailDTO.setModulePluginMap(modulePluginMapDTO); LOGGER.debug("Module-plugin map is set for batch instance: ", batchInstanceIdentifier); } } return workflowDetailDTO; }
From source file:com.intropro.prairie.utils.FileUtils.java
public static List<String> readLineInDirectory(File file) throws IOException { List<String> result = new LinkedList<>(); for (String child : file.list()) { File childFile = new File(file, child); if (childFile.isDirectory()) { result.addAll(readLineInDirectory(childFile)); } else {/*www . jav a 2 s. c o m*/ result.addAll(IOUtils.readLines(new FileInputStream(childFile))); } } return result; }
From source file:com.thoughtworks.go.config.MagicalGoConfigXmlLoader.java
public static List<ConfigErrors> validate(CruiseConfig config) { preprocess(config);/*from w ww. j a v a 2 s . c o m*/ List<ConfigErrors> validationErrors = new ArrayList<>(); validationErrors.addAll(config.validateAfterPreprocess()); return validationErrors; }