List of usage examples for java.util Collections addAll
@SafeVarargs public static <T> boolean addAll(Collection<? super T> c, T... elements)
From source file:kr.ac.korea.dbserver.parser.SQLAnalyzer.java
private Expr[] getRowValuePredicandsFromOrdinaryGroupingSetList(Ordinary_grouping_set_listContext ctx) { ArrayList<Expr> rowValuePredicands = new ArrayList<Expr>(); for (int i = 0; i < ctx.ordinary_grouping_set().size(); i++) { Collections.addAll(rowValuePredicands, getRowValuePredicandsFromOrdinaryGroupingSet(ctx.ordinary_grouping_set(i))); }/* w ww . j ava 2 s. com*/ return rowValuePredicands.toArray(new Expr[rowValuePredicands.size()]); }
From source file:com.google.dart.tools.ui.internal.refactoring.ServiceUtils_OLD.java
/** * Merges {@link TextChange}s from "newCompositeChange" into "existingCompositeChange". */// w ww .j a v a 2 s.c om private static void mergeTextChanges(org.eclipse.ltk.core.refactoring.CompositeChange existingCompositeChange, org.eclipse.ltk.core.refactoring.CompositeChange newCompositeChange) { // [element -> Change map] in CompositeChange Map<Object, org.eclipse.ltk.core.refactoring.Change> elementChanges = Maps.newHashMap(); for (org.eclipse.ltk.core.refactoring.Change change : existingCompositeChange.getChildren()) { Object modifiedElement = change.getModifiedElement(); elementChanges.put(modifiedElement, change); } // merge new changes into CompositeChange for (org.eclipse.ltk.core.refactoring.Change newChange : newCompositeChange.getChildren()) { // ignore if disabled (in preview UI) if (!newChange.isEnabled()) { continue; } // prepare existing TextChange Object modifiedElement = newChange.getModifiedElement(); org.eclipse.ltk.core.refactoring.Change existingChange = elementChanges.get(modifiedElement); // add TextEditChangeGroup from new TextChange if (existingChange instanceof TextChange && newChange instanceof TextChange) { TextChange existingTextChange = (TextChange) existingChange; TextEdit existingTextEdit = existingTextChange.getEdit(); TextChange newTextChange = (TextChange) newChange; // remember TextEdit(s) disabled in preview UI Set<TextEdit> disabledTextEdits = Sets.newHashSet(); for (TextEditChangeGroup group : newTextChange.getTextEditChangeGroups()) { if (!group.isEnabled()) { Collections.addAll(disabledTextEdits, group.getTextEdits()); } } // merge not disabled TextEdit(s) TextEdit newTextEdit = newTextChange.getEdit(); if (newTextEdit != null) { for (TextEdit childTextEdit : newTextEdit.getChildren()) { if (disabledTextEdits.contains(childTextEdit)) { continue; } childTextEdit.getParent().removeChild(childTextEdit); TextChangeCompatibility.insert(existingTextEdit, childTextEdit); } } } else { newCompositeChange.remove(newChange); existingCompositeChange.add(newChange); } } }
From source file:org.imsglobal.lti.toolProvider.ToolProvider.java
public void setParameterConstraint(String name, boolean required, int maxLength, String[] messageTypes) { name = StringUtils.trim(name);//from w w w.ja v a2 s . c o m if (name.length() > 0) { ParameterConstraint pc = new ParameterConstraint(required, maxLength); Set<String> types = new HashSet<String>(); Collections.addAll(types, messageTypes); pc.setMessageTypes(types); constraints.put(name, pc); } }
From source file:com.heliosapm.script.AbstractDeployedScript.java
/** * Adds a new notification type for this deployment * @param infos The notification infos to add *///from w w w . ja v a2 s .c om protected void registerNotifications(final MBeanNotificationInfo... infos) { if (infos == null || infos.length == 0) return; if (instanceNotificationInfos.isEmpty()) { Collections.addAll(instanceNotificationInfos, notificationInfos); } int added = 0; for (MBeanNotificationInfo info : infos) { if (info == null) continue; if (instanceNotificationInfos.add(info)) { added++; } } if (added > 0) { final Notification notif = new Notification(JMXHelper.MBEAN_INFO_CHANGED, objectName, sequence.incrementAndGet(), System.currentTimeMillis(), "Updated MBeanInfo"); notif.setUserData(JMXHelper.getMBeanInfo(objectName)); sendNotification(notif); } }
From source file:kr.ac.korea.dbserver.parser.SQLAnalyzer.java
private Expr[] getRowValuePredicandsFromOrdinaryGroupingSet(Ordinary_grouping_setContext ctx) { ArrayList<Expr> rowValuePredicands = new ArrayList<Expr>(); if (ctx.row_value_predicand() != null) { rowValuePredicands.add(visitRow_value_predicand(ctx.row_value_predicand())); }//from www .j av a2s .com if (ctx.row_value_predicand_list() != null) { Collections.addAll(rowValuePredicands, getRowValuePredicands(ctx.row_value_predicand_list())); } return rowValuePredicands.toArray(new Expr[rowValuePredicands.size()]); }
From source file:com.github.chenxiaolong.dualbootpatcher.switcher.InAppFlashingFragment.java
@Override public void onLoadFinished(Loader<LoaderResult> loader, LoaderResult result) { mBuiltinRoms.clear();//from w w w . j a v a2 s. c o m if (result.builtinRoms != null) { Collections.addAll(mBuiltinRoms, result.builtinRoms); } if (result.currentRom != null) { mCurrentRomId = result.currentRom.getId(); } mProgressBar.setVisibility(View.GONE); }
From source file:net.sf.jabref.exporter.FileActions.java
/** * Saves the database to file, including only the entries included in the * supplied input array bes./*from www.j a v a 2s . co m*/ * * @return A List containing warnings, if any. */ public static SaveSession savePartOfDatabase(BibDatabase database, MetaData metaData, File file, JabRefPreferences prefs, BibEntry[] bes, Charset encoding, DatabaseSaveType saveType) throws SaveException { BibEntry be = null; boolean backup = prefs.getBoolean(JabRefPreferences.BACKUP); SaveSession session; try { session = new SaveSession(file, encoding, backup); } catch (IOException e) { throw new SaveException(e.getMessage(), e.getLocalizedMessage()); } // Map to collect entry type definitions // that we must save along with entries using them. Map<String, EntryType> types = new TreeMap<>(); // Define our data stream. try (VerifyingWriter fw = session.getWriter()) { if (saveType != DatabaseSaveType.PLAIN_BIBTEX) { // Write signature. FileActions.writeBibFileHeader(fw, encoding); } // Write preamble if there is one. FileActions.writePreamble(fw, database.getPreamble()); // Write strings if there are any. FileActions.writeStrings(fw, database); // Write database entries. Take care, using CrossRefEntry- // Comparator, that referred entries occur after referring // ones. Apart from crossref requirements, entries will be // sorted as they appear on the screen. List<Comparator<BibEntry>> comparators = FileActions.getSaveComparators(true, metaData); // Use glazed lists to get a sorted view of the entries: List<BibEntry> sorter = new ArrayList<>(bes.length); Collections.addAll(sorter, bes); Collections.sort(sorter, new FieldComparatorStack<>(comparators)); BibEntryWriter bibtexEntryWriter = new BibEntryWriter(new LatexFieldFormatter(), true); for (BibEntry aSorter : sorter) { be = aSorter; // Check if we must write the type definition for this // entry, as well. Our criterion is that all non-standard // types (*not* customized standard types) must be written. EntryType tp = be.getType(); if (EntryTypes.getStandardType(tp.getName()) == null) { types.put(tp.getName(), tp); } bibtexEntryWriter.write(be, fw); //only append newline if the entry has changed if (!be.hasChanged()) { fw.write(Globals.NEWLINE); } } // Write meta data. if ((saveType != DatabaseSaveType.PLAIN_BIBTEX) && (metaData != null)) { metaData.writeMetaData(fw); } // Write type definitions, if any: if (!types.isEmpty()) { for (Map.Entry<String, EntryType> stringBibtexEntryTypeEntry : types.entrySet()) { CustomEntryType tp = (CustomEntryType) stringBibtexEntryTypeEntry.getValue(); CustomEntryTypesManager.save(tp, fw); fw.write(Globals.NEWLINE); } } } catch (Throwable ex) { session.cancel(); //repairAfterError(file, backup, status); throw new SaveException(ex.getMessage(), ex.getLocalizedMessage(), be); } return session; }
From source file:com.all.testing.MockInyectRunner.java
@SuppressWarnings("unchecked") private List<Field> getFields(Object target) { List<Field> fields = new ArrayList<Field>(); Class claz = target.getClass(); while (claz.getSuperclass() != null) { Field[] declaredFields = claz.getDeclaredFields(); Collections.addAll(fields, declaredFields); claz = claz.getSuperclass();// w ww . j a va 2 s . co m } return fields; }
From source file:com.igormaznitsa.ideamindmap.utils.IdeaUtils.java
public static List<PsiExtraFile> findPsiFileLinksForProjectScope(final Project project) { List<PsiExtraFile> result = new ArrayList<PsiExtraFile>(); Collection<VirtualFile> virtualFiles = FileBasedIndex.getInstance().getContainingFiles(FileTypeIndex.NAME, MindMapFileType.INSTANCE, GlobalSearchScope.allScope(project)); for (VirtualFile virtualFile : virtualFiles) { final MMDFile simpleFile = (MMDFile) PsiManager.getInstance(project).findFile(virtualFile); if (simpleFile != null) { final PsiExtraFile[] fileLinks = PsiTreeUtil.getChildrenOfType(simpleFile, PsiExtraFile.class); if (fileLinks != null) { Collections.addAll(result, fileLinks); }// ww w . j a va2 s . c o m } } return result; }
From source file:io.cloudslang.samples.StandAloneTest.java
private void registerEventListener(String... eventTypes) { Set<String> handlerTypes = new HashSet<>(); Collections.addAll(handlerTypes, eventTypes); eventBus.subscribe(new ScoreEventListener() { @Override/*www .j av a 2 s. com*/ public void onEvent(ScoreEvent event) { logger.info("Listener " + this.toString() + " invoked on type: " + event.getEventType() + " with data: " + event.getData()); eventQueue.add(event); } }, handlerTypes); }