Example usage for java.util List addAll

List of usage examples for java.util List addAll

Introduction

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

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

Usage

From source file:com.google.cloud.runtimes.builder.Application.java

/**
 * Gets the override settings from the command line.
 *
 * @param cmd the command line in which to check for the settings.
 * @return a map of the settings.//from w w  w  .  j  av a2s . c om
 */
@VisibleForTesting
public static Map<String, Object> getAppYamlOverrideSettings(CommandLine cmd) {
    List<Field> configFields = OverrideableSetting.getOverridableFields(RuntimeConfig.class);
    configFields.addAll(OverrideableSetting.getOverridableFields(BetaSettings.class));
    Map<String, Object> configMap = new HashMap<>();
    doForEachOverrideSetting(configFields, name -> {
        if (cmd.hasOption(name)) {
            configMap.put(name, true);
        }
    }, name -> {
        String value = cmd.getOptionValue(name);
        if (value != null) {
            configMap.put(name, cmd.getOptionValue(name));
        }
    });
    return configMap;
}

From source file:Main.java

static private List<File> getFiles(String src) {
    List<File> list = new ArrayList<File>();
    File f = new File(src);
    File files[] = f.listFiles();
    for (File file : files) {
        if (file.isFile()) {
            list.add(file);//from w ww  .  j  av  a  2s  .  c o m
        } else {
            list.addAll(getFiles(file.getPath()));
        }
    }
    return list;
}

From source file:com.jaspersoft.jasperserver.api.engine.jasperreports.domain.impl.CompositeReportExecutionListener.java

public static ReportExecutionListener combine(ReportExecutionListener first, ReportExecutionListener second) {
    List<ReportExecutionListener> firstList = list(first);
    List<ReportExecutionListener> secondList = list(second);

    ReportExecutionListener combined;//from ww  w  . ja  va 2 s  . c o  m
    if (firstList.isEmpty()) {
        if (secondList.isEmpty()) {
            combined = EMPTY;
        } else {
            combined = second;
        }
    } else if (secondList.isEmpty()) {
        combined = first;
    } else {
        List<ReportExecutionListener> list = new ArrayList<ReportExecutionListener>(
                firstList.size() + secondList.size());
        list.addAll(firstList);
        list.addAll(secondList);
        combined = new CompositeReportExecutionListener(list);
    }
    return combined;
}

From source file:de.tudarmstadt.ukp.experiments.argumentation.sequence.evaluation.helpers.FinalTableExtractor.java

public static <T> String tableToCsv(Table<String, String, T> table) throws IOException {
    StringWriter sw = new StringWriter();
    CSVPrinter printer = new CSVPrinter(sw, CSVFormat.DEFAULT);

    List<String> firstRow = new ArrayList<>();
    firstRow.add(" ");
    firstRow.addAll(table.columnKeySet());
    printer.printRecord(firstRow);/*from   w  w  w  . ja va  2  s  .c  o  m*/

    for (String rowKey : table.rowKeySet()) {
        printer.print(rowKey);
        for (String columnKey : table.columnKeySet()) {
            printer.print(table.get(rowKey, columnKey));
        }
        printer.println();
    }

    printer.close();

    return sw.toString();
}

From source file:edu.berkeley.nwbqueryengine.util.ValuesUtil.java

public static List<NwbResult> removeDuplicities(List<NwbResult> input) {
    List<NwbResult> al = new ArrayList<>(input);
    Set<NwbResult> hs = new HashSet<>();
    hs.addAll(al);/* w  w  w.  j av  a  2  s .c  o m*/
    al.clear();
    al.addAll(hs);
    return al;
}

From source file:com.moz.fiji.schema.mapreduce.DistributedCacheJars.java

/**
 * Adds the jars from a directory into the distributed cache of a job.
 *
 * @param job The job to configure./*from  w  w  w  .ja  v  a2s .  co  m*/
 * @param jarDirectory A path to a directory of jar files.
 * @throws IOException If there is a problem reading from the file system.
 */
public static void addJarsToDistributedCache(Job job, File jarDirectory) throws IOException {
    if (null == jarDirectory) {
        throw new IllegalArgumentException("Jar directory may not be null");
    }
    if (!jarDirectory.exists()) {
        throw new IOException("The jar directory " + jarDirectory.getPath() + " does not exist.");
    }

    List<String> allJars = new ArrayList<String>();

    // Get existing jars named in configuration.
    allJars.addAll(getJarsFromConfiguration(job.getConfiguration()));

    // Add jars from jarDirectory.
    allJars.addAll(getJarsFromDirectory(job.getConfiguration(), jarDirectory));

    // De-dupe
    List<String> deDupedJars = deDuplicateJarNames(allJars);
    job.getConfiguration().set(CONF_TMPJARS, StringUtils.join(deDupedJars, ","));
}

From source file:Main.java

static List<File> recursiveGetFile(File f, FileFilter ff) {
    List<File> lf = new ArrayList<File>();
    if (f.isFile()) {
        if (ff.accept(f)) {
            lf.add(f);//  w w  w. j a v a 2  s .c om
        }
    } else {
        File[] fs = f.listFiles();
        for (File tempF : fs) {
            lf.addAll(recursiveGetFile(tempF, ff));
        }
    }
    return lf;
}

From source file:Main.java

@SuppressWarnings("unchecked")
public static <T> List<T> getAllComponents(final Container c, Class<T> classType) {
    Component[] comps = c.getComponents();
    List<T> compList = new ArrayList<T>();
    for (Component comp : comps) {
        if (classType.isInstance(comp)) {
            compList.add((T) comp);// w w  w . j  a  v a 2 s  . c  om
        }
        if (comp instanceof Container) {
            compList.addAll(getAllComponents((Container) comp, classType));
        }
    }
    return compList;
}

From source file:cc.kave.commons.externalserializationtests.ExternalTestCaseProvider.java

private static List<TestCase[]> recursiveGetTestCases(File currentDirectory, String rootPrefix)
        throws ClassNotFoundException, IOException {
    List<TestCase[]> testCases = getTestCasesInCurrentFolder(currentDirectory, rootPrefix);

    for (File subdirectory : getSubdirectories(currentDirectory)) {
        testCases.addAll(recursiveGetTestCases(subdirectory, rootPrefix));
    }//from ww w  .j  a  v a2 s . c o  m

    return testCases;
}

From source file:edu.coeia.reports.IndexUtil.java

public static List<String> getAllFilesHaveAuthers(final CaseFacade caseFacade, List<String> authers)
        throws IOException {
    List<String> files = new ArrayList<String>();
    files.addAll(getAllFilePathsHaveAuther(caseFacade, authers));
    return files;
}