Example usage for java.util Collections addAll

List of usage examples for java.util Collections addAll

Introduction

In this page you can find the example usage for java.util Collections addAll.

Prototype

@SafeVarargs
public static <T> boolean addAll(Collection<? super T> c, T... elements) 

Source Link

Document

Adds all of the specified elements to the specified collection.

Usage

From source file:edu.ku.brc.specify.tools.l10nios.StrLocalizerAppForiOS.java

/**
 * @param hideExisting//from  www  .  j  a  v  a 2  s. c  o  m
 * @return
 */
private Locale doChooseLangLocale(final Locale hideLocale) {
    Vector<Locale> locales = new Vector<Locale>();
    Collections.addAll(locales, Locale.getAvailableLocales());

    String[] langs = { "es", "sv", "sq", "fr" };
    Vector<Locale> destLocales = new Vector<Locale>();
    destLocales.add(Locale.GERMAN);
    for (String lang : langs) {
        appendLocale(locales, destLocales, lang);
    }

    Vector<String> localeNames = new Vector<String>();
    for (Locale l : destLocales) {
        localeNames.add(l.getDisplayName());
    }

    ToggleButtonChooserDlg<String> chooser = new ToggleButtonChooserDlg<String>((Frame) null, "CHOOSE_LOCALE",
            localeNames, ToggleButtonChooserPanel.Type.RadioButton);
    chooser.setUseScrollPane(true);
    UIHelper.centerAndShow(chooser);

    if (!chooser.isCancelled()) {
        return destLocales.get(chooser.getSelectedIndex());
    }
    return null;
}

From source file:io.restassured.module.mockmvc.RestAssuredMockMvc.java

/**
 * Assign one or more {@link org.springframework.test.web.servlet.ResultHandler} that'll be executes after a request has been made.
 *
 * @param resultHandler  The result handler
 * @param resultHandlers Additional result handlers (optional)
 *//*www .  ja  v  a2s .  co m*/
public static void resultHandlers(ResultHandler resultHandler, ResultHandler... resultHandlers) {
    notNull(resultHandler, ResultHandler.class);
    RestAssuredMockMvc.resultHandlers.add(resultHandler);
    if (resultHandlers != null && resultHandlers.length >= 1) {
        Collections.addAll(RestAssuredMockMvc.resultHandlers, resultHandlers);
    }
}

From source file:com.twinsoft.convertigo.engine.localbuild.BuildLocally.java

/***
 * Function which permit to run cordova command
 * @param projectDir// ww w  .  ja v  a  2 s  .  c  o m
 * @param commands
 * @return
 * @throws Throwable
 */
private String runCordovaCommand(File projectDir, String... commands) throws Throwable {
    List<String> commandsList = new LinkedList<String>();
    Collections.addAll(commandsList, commands);
    return runCordovaCommand(projectDir, commandsList);
}

From source file:interactivespaces.workbench.tasks.WorkbenchTaskContext.java

/**
 * Add all JAR files from the given directory to the list of files.
 *
 * @param directory// w w w. jav a2s  . c o m
 *          the directory to get the jar files from
 * @param fileList
 *          the list to add the files to
 */
public void addJarFiles(File directory, List<File> fileList) {
    File[] files = directory.listFiles(new FileFilter() {
        @Override
        public boolean accept(File pathname) {
            return pathname.getName().endsWith(FILENAME_JAR_EXTENSION);
        }
    });
    if (files != null) {
        Collections.addAll(fileList, files);
    }
}

From source file:be.wimsymons.intellij.polopolyimport.PPImporter.java

@SuppressWarnings("UnsafeVfsRecursion")
private void recurseFiles(@NotNull VirtualFile virtualFile, @NotNull ContentIterator iterator) {
    TreeSet<VirtualFile> sortedDeduplicatedFiles = new TreeSet<VirtualFile>(new Comparator<VirtualFile>() {
        @Override//from  w  ww  . j ava  2 s  . c om
        public int compare(VirtualFile f1, VirtualFile f2) {
            return f1.getName().compareTo(f2.getName());
        }
    });
    if (virtualFile.isDirectory()) {
        Collections.addAll(sortedDeduplicatedFiles, virtualFile.getChildren());
        for (VirtualFile child : sortedDeduplicatedFiles) {
            recurseFiles(child, iterator);
        }
    } else {
        iterator.processFile(virtualFile);
    }
}

From source file:edu.ku.brc.specify.dbsupport.cleanuptools.GeographyAssignISOs.java

private int getUnitedStatesIndex(final Object[] titles) {
    Vector<Object> list = new Vector<Object>();
    Collections.addAll(list, titles);
    String[] names = { "United States", "USA", "U.S.A.", "United States of America" };
    for (String nm : names) {
        int index = list.indexOf(nm);
        if (index > -1) {
            return index;
        }/*from   w w  w  .ja v  a  2 s  .  c om*/
    }
    return -1;
}

From source file:org.agatom.springatom.cmp.wizards.validation.ValidationServiceImpl.java

private WizardResult applyMessages(final MessageContext messageContext, final WizardResult partialResult) {
    final WizardResult local = new WizardResult();

    final Set<Message> messages = Sets.newTreeSet(MESSAGE_COMPARATOR);
    Collections.addAll(messages, messageContext.getAllMessages());
    local.setValidationMessages(messages);

    return partialResult.merge(local);
}

From source file:org.gvsig.framework.web.controllers.OGCInfoController.java

/**
 * Get layer FeatureInfo of service WMS and show it in page
 *
 * @param request the {@code HttpServletRequest}.
 * @param uiModel the {@code Model}.//  w  w w.jav a2 s.com
 * @return ResponseEntity with FeatureInfo data of wms server
 */
@RequestMapping(params = "getWmsFeatureInfo", headers = "Accept=application/json")
public ResponseEntity<String> getWmsFeatureInfo(WebRequest request, Model uiModel) {
    String urlServer = request.getParameter("url");
    String crs = request.getParameter("crs");
    String layers = request.getParameter("layers");
    String styles = request.getParameter("styles");
    int x = Integer.parseInt(request.getParameter("pointX"));
    int y = Integer.parseInt(request.getParameter("pointY"));
    int heigth = Integer.parseInt(request.getParameter("mapHeight"));
    int width = Integer.parseInt(request.getParameter("mapWidth"));
    String bounds = request.getParameter("bounds");

    String featureInfo = null;

    Vector<String> layersVector = new Vector<String>();
    if (StringUtils.isNotEmpty(layers)) {
        Collections.addAll(layersVector, layers.split(","));
    }

    Vector<String> stylesVector = new Vector<String>();
    if (StringUtils.isNotBlank(styles)) {
        Collections.addAll(stylesVector, styles.split(","));
    }

    List<String> boundsTree = new ArrayList<String>();
    if (StringUtils.isNotBlank(bounds)) {
        Collections.addAll(boundsTree, bounds.split(","));
    }

    if (StringUtils.isNotEmpty(urlServer)) {
        featureInfo = ogcInfoServ.getFeatureInfoFromWMS(urlServer, crs, layersVector, stylesVector, x, y,
                heigth, width, boundsTree);
    }

    return new ResponseEntity<String>(featureInfo, HttpStatus.OK);
}

From source file:de.openali.odysseus.chart.factory.config.resolver.ChartTypeResolver.java

private AxisType findUrlMapperType(final URL context, final String uri, final String identifier)
        throws XmlException, IOException {
    final ChartConfigurationLoader loader = getLoader(context, uri);
    final ChartType[] charts = loader.getCharts();

    final List<ChartType> chartTypes = new ArrayList<>();
    Collections.addAll(chartTypes, charts);

    for (final ChartType chart : chartTypes) {
        final Mappers mappers = chart.getMappers();
        final AxisType[] axes = mappers.getAxisArray();
        for (final AxisType axis : axes) {
            if (axis.getId().equals(identifier))
                return axis;
        }//  ww w .  j av  a  2s  . co m

        final ScreenAxisType[] screenAxes = mappers.getScreenAxisArray();
        for (final ScreenAxisType screenAxis : screenAxes) {
            if (screenAxis.getId().equals(identifier))
                return (AxisType) screenAxis;
        }
    }

    return null;
}

From source file:ddf.common.test.ServiceManager.java

/**
 * Restarts one or more bundles. The bundles will be stopped in the order provided and started
 * in the reverse order./*from   w  w w.  jav a 2 s  .c  o m*/
 *
 * @param bundleSymbolicNames list of bundle symbolic names to restart
 * @throws BundleException if one of the bundles fails to stop or start
 */
public void restartBundles(String... bundleSymbolicNames) throws BundleException {
    LOGGER.debug("Restarting bundles {}", bundleSymbolicNames);

    Set<String> bundleSymbolicNameSet = new HashSet<>();
    Collections.addAll(bundleSymbolicNameSet, bundleSymbolicNames);

    Map<String, Bundle> bundlesToRestart = getBundlesToRestart(bundleSymbolicNameSet);

    for (int i = 0; i < bundleSymbolicNames.length; i++) {
        bundlesToRestart.get(bundleSymbolicNames[i]).stop();
    }

    for (int i = bundleSymbolicNames.length - 1; i > 0; i--) {
        bundlesToRestart.get(bundleSymbolicNames[i]).start();
    }
}