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:cloudlens.engine.CLBuilder.java

private static List<CLElement> extractElements(List<CLElement> elements) {
    elements.addAll(nextList);
    nextList = new ArrayList<>();
    blockGuard = false;//from  ww w .  j  av a  2 s .  c o  m
    return getElements(elements);
}

From source file:io.dataapps.chlorine.finder.FinderEngine.java

private static List<Finder> createFinders(Set<FinderProvider> finderProviders) {
    List<Finder> finders = new ArrayList<>();
    for (FinderProvider provider : finderProviders) {
        finders.addAll(provider.getFinders());
    }/*from   w w w. j ava2 s.co  m*/
    return finders;
}

From source file:org.openmrs.contrib.discohub.GithubUtils.java

/**
 * Will fetch a list of items from a Github GET call based on a json key
 *
 * @param url/* w ww  .j  a va 2 s  .  co  m*/
 * @param jsonKey
 * @return
 * @throws IOException
 */
private static List<String> getPageData(String url, String jsonKey) throws IOException {
    List<String> list = new ArrayList<>();
    Header[] headers = { GITHUB_JSON_ACCEPT_HEADER, GITHUB_BASIC_AUTH_HEADER };
    Map<String, Object> data = HttpUtils.getData(url, headers);
    list.addAll(getJsonResponseAsList((String) data.get("content"), jsonKey));
    Header[] responseHeaders = (Header[]) data.get("headers");
    if (null != responseHeaders && responseHeaders.length > 0) {
        for (int i = 0; i < responseHeaders.length; i++) {
            if (responseHeaders[i].getName().equals("Link")) {
                String headerValue = responseHeaders[i].getValue();
                if (headerValue.contains("rel=\"next\"")) {
                    list.addAll(getPageData(headerValue.substring(1, headerValue.indexOf(">")), jsonKey));
                }
                break;
            }
        }
    }
    return list;
}

From source file:com.reachlocal.grails.plugins.cassandra.utils.OrmHelper.java

public static Map<String, Object> sort(Map<String, Object> map) {
    Map<String, Object> sorted = new LinkedHashMap<String, Object>();
    List<String> keys = new ArrayList<String>(map.size());
    keys.addAll(map.keySet());
    Collections.sort(keys);/*from   w  ww.j a v  a2s  .  c o  m*/
    for (String key : keys) {
        sorted.put(key, map.get(key));
    }
    return sorted;
}

From source file:net.sf.taverna.t2.workbench.file.impl.DataflowPersistenceHandlerRegistry.java

@SuppressWarnings("unchecked")
protected static List<Class<?>> findAllParentClasses(final Class<?> sourceClass) {
    List<Class<?>> superClasses = new ArrayList<>();
    superClasses.add(sourceClass);/* w  ww .jav a2s .co m*/
    superClasses.addAll(getAllSuperclasses(sourceClass));
    superClasses.addAll(getAllInterfaces(sourceClass));
    return superClasses;
}

From source file:com.epam.catgenome.util.HistogramUtils.java

private static void addBlockToHistogram(Future<List<Wig>> future, final List<Wig> histogram) {
    try {//from   w  ww.j  av  a 2 s. c o m
        if (future != null) {
            List<Wig> portion = future.get();
            if (portion != null) {
                histogram.addAll(portion);
            }
        }
    } catch (InterruptedException | ExecutionException e) {
        LOGGER.error("Exception while making histogram :", e);
    }
}

From source file:edu.pitt.dbmi.ccd.db.specification.AnnotationTargetSpecification.java

private static Predicate buildSearchSpec(Root<AnnotationTarget> root, CriteriaBuilder cb, String username,
        String type, Set<String> matches, Set<String> nots) {
    List<Predicate> predicates = new ArrayList<>(0);
    predicates.add(buildFilterSpec(root, cb, username, type));
    if (!isEmpty(matches)) {
        predicates.addAll(inTitleOrAddressOrName(root, cb, matches));
    }/*from w w w .  j av a  2 s  .c  om*/
    if (!isEmpty(nots)) {
        predicates.addAll(notInTitleOrAddressOrName(root, cb, nots));
    }
    return cb.and(predicates.toArray(new Predicate[predicates.size()]));
}

From source file:com.l2jfree.gameserver.document.DocumentEngine.java

private static List<L2Item> loadData(Map<Integer, Item> itemData, File[] files) {
    final List<L2Item> list = new ArrayList<L2Item>();

    for (File f : files) {
        DocumentItem document = new DocumentItem(itemData, f);
        document.parse();/* w  w  w .  j  ava  2  s  .  com*/
        list.addAll(document.getItemList());
    }

    return list;
}

From source file:com.viddu.handlebars.HandlebarsFileUtil.java

/**
 * Utility method to load Files in a given directory.
 * // w  w  w .ja  va  2s  .  co m
 * @param outDir
 * @return
 */
public static List<File> loadHandlebarTemplates(File outDir) {
    List<File> fileList = new ArrayList<File>();
    if (outDir.isDirectory()) {
        File[] filesAndDirs = outDir.listFiles();
        for (File file : filesAndDirs) {
            if (file.isDirectory()) {
                fileList.addAll(loadHandlebarTemplates(file));
            } else {
                if (FilenameUtils.isExtension(file.getName(), supportedExt)) {
                    fileList.add(file);
                }
            }
        }
    }
    return fileList;
}

From source file:de.tudarmstadt.ukp.dkpro.core.testing.IOTestRunner.java

public static void testOneWay2(Class<? extends CollectionReader> aReader,
        Class<? extends AnalysisComponent> aWriter, String aExpectedFile, String aOutputFile, String aFile,
        Object... aExtraParams) throws Exception {
    String outputFolder = aReader.getSimpleName() + "-" + FilenameUtils.getBaseName(aFile);
    if (DkproTestContext.get() != null) {
        outputFolder = DkproTestContext.get().getTestOutputFolderName();
    }/*  ww w  .  ja  va 2  s  .c o m*/

    File reference = new File("src/test/resources/" + aExpectedFile);
    File input = new File("src/test/resources/" + aFile);
    File output = new File("target/test-output/" + outputFolder);

    List<Object> extraReaderParams = new ArrayList<>();
    extraReaderParams.add(ComponentParameters.PARAM_SOURCE_LOCATION);
    extraReaderParams.add(input);
    extraReaderParams.addAll(asList(aExtraParams));

    CollectionReaderDescription reader = createReaderDescription(aReader, extraReaderParams.toArray());

    List<Object> extraWriterParams = new ArrayList<>();
    if (!ArrayUtils.contains(aExtraParams, ComponentParameters.PARAM_TARGET_LOCATION)) {
        extraWriterParams.add(ComponentParameters.PARAM_TARGET_LOCATION);
        extraWriterParams.add(output);
    }
    extraWriterParams.add(ComponentParameters.PARAM_STRIP_EXTENSION);
    extraWriterParams.add(true);
    extraWriterParams.addAll(asList(aExtraParams));

    AnalysisEngineDescription writer = createEngineDescription(aWriter, extraWriterParams.toArray());

    runPipeline(reader, writer);

    String expected = FileUtils.readFileToString(reference, "UTF-8");
    String actual = FileUtils.readFileToString(new File(output, aOutputFile), "UTF-8");
    assertEquals(expected.trim(), actual.trim());
}