List of usage examples for java.util List addAll
boolean addAll(Collection<? extends E> c);
From source file:com.amalto.workbench.utils.FKFilterParser.java
public static String parseFilter(String filter, List<Line> lines, String[] keyNames) { String customFilter = blank;// www . j a v a2 s . c om if (filter != null && filter.length() > 0) { if (filter.startsWith(CUSTOM_FILTERS_PREFIX)) { customFilter = StringEscapeUtils.unescapeXml(filter); } else { lines.addAll(buildLine(filter, keyNames)); } } return customFilter; }
From source file:cc.redpen.Main.java
private static List<Document> getDocuments(String inputFormat, String inputSentence, String[] inputFileNames, RedPen redPen) throws RedPenException { List<Document> documents = new ArrayList<>(); DocumentParser parser = DocumentParser.of(inputFormat); if (inputSentence == null) { documents.addAll(redPen.parse(parser, extractInputFiles(inputFileNames))); } else {/* w w w . j a v a2s . co m*/ documents.add(redPen.parse(parser, inputSentence)); } return documents; }
From source file:com.deepoove.poi.resolver.TemplateResolver.java
public static List<ElementTemplate> parseElementTemplates(NiceXWPFDocument doc) { if (null == doc) return null; List<ElementTemplate> rts = new ArrayList<ElementTemplate>(); rts.addAll(parseParagraph(doc.getParagraphs())); rts.addAll(parseTable(doc.getTables())); List<XWPFHeader> headers = doc.getHeaderList(); if (null != headers) { for (XWPFHeader header : headers) { rts.addAll(parseParagraph(header.getParagraphs())); rts.addAll(parseTable(header.getTables())); }//from w w w .j a v a 2s .c o m } List<XWPFFooter> footers = doc.getFooterList(); if (null != footers) { for (XWPFFooter footer : footers) { rts.addAll(parseParagraph(footer.getParagraphs())); rts.addAll(parseTable(footer.getTables())); } } return rts; }
From source file:com.liveramp.cascading_ext.counters.Counters.java
private static List<Counter> getCountersForGroup(FlowStats flowStats, String group) { List<Counter> counters = new ArrayList<Counter>(); for (FlowStepStats step : flowStats.getFlowStepStats()) { counters.addAll(getStatsFromStep(step, group)); }//w w w .j a v a 2 s . c o m Collections.sort(counters); return counters; }
From source file:edu.unc.lib.dl.util.FileUtils.java
public static List<File> getFilesInDir(File dir) { List<File> result = new ArrayList<File>(); File[] contents = dir.listFiles(); for (int i = 0; i < contents.length; i++) { if (contents[i].isDirectory()) { result.addAll(getFilesInDir(contents[i])); } else {/* w w w .j a v a 2 s . c om*/ result.add(contents[i]); } } return result; }
From source file:com.powers.wsexplorer.gui.GUIUtil.java
public static Listener createTextSortListener(final Table table, final Map<String, String> map) { Listener sortListener = new Listener() { public void handleEvent(Event e) { final int direction = table.getSortDirection(); Collator collator = Collator.getInstance(Locale.getDefault()); TableColumn column = (TableColumn) e.widget; Set<String> keys = map.keySet(); List<String> l = new LinkedList<String>(); l.addAll(keys); Collections.sort(l, collator); if (direction == SWT.DOWN) { Collections.reverse(l); table.setSortDirection(SWT.UP); } else { table.setSortDirection(SWT.DOWN); }/*from w ww . j a v a2 s . co m*/ table.removeAll(); Iterator<String> itr = l.iterator(); String key = null; String value = null; while (itr.hasNext()) { key = itr.next(); if (StringUtils.isNotBlank(key)) { TableItem ti = new TableItem(table, SWT.BORDER); ti.setText(0, key); value = map.get(key); if (StringUtils.isNotBlank(value)) { ti.setText(1, value); } } } table.setSortColumn(column); } }; return sortListener; }
From source file:org.mayocat.application.AbstractService.java
private static List<Field> getAllFields(Class<?> type) { List<Field> fields = new ArrayList<Field>(); fields.addAll(Arrays.asList(type.getDeclaredFields())); if (type.getSuperclass() != null) { fields.addAll(getAllFields(type.getSuperclass())); }// w w w .ja v a 2 s .co m return fields; }
From source file:com.xpn.xwiki.internal.merge.MergeUtils.java
/** * Merge a {@link List}./*ww w. ja v a 2s.co m*/ * * @param <T> the type of the lists elements * @param commonAncestor previous version of the collection * @param next new version of the collection * @param current current version of the collection to modify * @param mergeResult the merge report */ public static <T> void mergeList(List<T> commonAncestor, List<T> next, List<T> current, MergeResult mergeResult) { org.xwiki.diff.MergeResult<T> result; try { result = diffManager.merge(commonAncestor, next, current, null); current.clear(); current.addAll(result.getMerged()); } catch (MergeException e) { mergeResult.getLog().error("Failed to execute merge lists", e); } }
From source file:com.xwiki.authentication.guanxi.GuanxiShibConfigurator.java
/** * /*from ww w. j av a 2s . c o m*/ * Load the config from file */ public static GuanxiShibConfig getGuanxiShibConfig() { if (log.isDebugEnabled()) { log.debug("Loading GuanxiShibConfig using " + GuanxiShibConstants.PROPERTIES_FILE + " for GX-Auth values"); } GuanxiShibConfig config = new GuanxiShibConfig(); try { // load the config from file InputStream propertiesIn = null; propertiesIn = GuanxiShibAuthenticator.class.getResourceAsStream(GuanxiShibConstants.PROPERTIES_FILE); Properties configProperties = new Properties(); configProperties.load(propertiesIn); // set properties file config.setPropertiesFile(configProperties.getProperty(GuanxiShibConstants.PROPERTIES_FILE)); if (log.isDebugEnabled()) { log.debug("GuanxiAuthenticator Properties file set to: " + config.getPropertiesFile()); } // set create users config.setCreateUsers( Boolean.valueOf(configProperties.getProperty(GuanxiShibConstants.CREATE_USERS)).booleanValue()); if (log.isDebugEnabled()) { log.debug("GuanxiAuthenticator set to create users: " + config.isCreateUsers()); } // set update info config.setUpdateInfo( Boolean.valueOf(configProperties.getProperty(GuanxiShibConstants.UPDATE_INFO)).booleanValue()); if (log.isDebugEnabled()) { log.debug("GuanxiAuthenticator set to update info: " + config.isUpdateInfo()); } // set default groups List defaultGroups = new ArrayList(); String groups = configProperties.getProperty(GuanxiShibConstants.DEFAULT_XWIKI_GROUPS); if (groups != null) { defaultGroups.addAll(StringUtils.toListDelimitedByComma(groups)); if (log.isDebugEnabled()) { for (Iterator i = defaultGroups.iterator(); i.hasNext();) { log.debug("Adding group " + i.next().toString() + " to list of groups"); } } } config.setDefaultGroups(defaultGroups); // set default user space config.setDefaultUserSpace(configProperties.getProperty(GuanxiShibConstants.DEFAULT_XWIKI_USER_SPACE)); if (log.isDebugEnabled()) { log.debug("GuanxiAuthenticator using " + config.getDefaultUserSpace() + " as user space"); } // set userid header config.setHeaderUserid(configProperties.getProperty(GuanxiShibConstants.HEADER_USERID)); if (log.isDebugEnabled()) { log.debug("GuanxiAuthenticator userid header set to " + config.getHeaderUserid()); } // set header mail config.setHeaderMail(configProperties.getProperty(GuanxiShibConstants.HEADER_MAIL)); if (log.isDebugEnabled()) { log.debug("GuanxiAuthenticator mail header set to " + config.getHeaderMail()); } // set header fullname config.setHeaderFullname(configProperties.getProperty(GuanxiShibConstants.HEADER_FULLNAME)); if (log.isDebugEnabled()) { log.debug("GuanxiAuthenticator fullname header set to " + config.getHeaderFullname()); } // set config.setReplacementChar(configProperties.getProperty(GuanxiShibConstants.REPLACEMENT_CHAR)); if (log.isDebugEnabled()) { log.debug("GuanxiAuthenticator replacement character set to " + config.getReplacementChar()); } } catch (IOException e) { log.warn("Unable to read properties from file, defaulting", e); } return config; }
From source file:com.norconex.commons.lang.ClassFinder.java
/** * Finds the names of all subtypes of the super class in list * of {@link File} supplied.//from w w w .j a v a 2 s. c o m * This method is null-safe. If no classes are found, * an empty list will be returned. * @param files directories and/or JARs to scan for classes * @param superClass the class from which to find subtypes * @return list of class names * @since 1.4.0 */ public static List<String> findSubTypes(List<File> files, Class<?> superClass) { List<String> classes = new ArrayList<String>(); if (superClass == null || files == null) { return classes; } for (File file : files) { classes.addAll(findSubTypes(file, superClass)); } return classes; }