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.huawei.streaming.cql.semanticanalyzer.BaseAnalyzer.java

/**
 * ??//www .j  a v  a 2s  .co m
 * select *
 * @param schemas schema
 * @return 
 */
protected static List<Column> getAllAttributes(List<Schema> schemas) {
    List<Column> attrs = new ArrayList<Column>();
    for (Schema schema : schemas) {
        attrs.addAll(getAttributes(schema));
    }
    return attrs;
}

From source file:Lists.java

public static <T> List<T> addAll(List<T> list, int index, List<T> toAdd) {
    switch (toAdd.size()) {
    case 0:/*www  . j  a  v  a 2  s. c  o  m*/
        // No-op.
        return list;
    case 1:
        // Add one element.
        return add(list, index, toAdd.get(0));
    default:
        // True list merge, result >= 2.
        switch (list.size()) {
        case 0:
            if (index != 0) {
                throw newIndexOutOfBounds(list, index);
            }
            return new ArrayList<T>(toAdd);
        case 1: {
            List<T> result = new ArrayList<T>(1 + toAdd.size());
            switch (index) {
            case 0:
                result.addAll(toAdd);
                result.add(list.get(0));
                return result;
            case 1:
                result.add(list.get(0));
                result.addAll(toAdd);
                return result;
            default:
                throw newIndexOutOfBounds(list, index);
            }
        }
        default:
            list.addAll(index, toAdd);
            return list;
        }
    }
}

From source file:com.aurel.track.exchange.docx.exporter.DocxTemplateBL.java

/**
 * Gets the list of existing templates/*from  w w  w. j a  v a2s. c o  m*/
 * @return
 */
private static List<LabelValueBean> getExistingTemplates() {
    List<LabelValueBean> templates = new LinkedList<LabelValueBean>();

    templates = getExistingTemplates(getWordTemplatesDir());
    templates.addAll(getExistingTemplates(getLatexTemplatesDir()));

    return templates;
}

From source file:alluxio.cli.ValidateEnv.java

private static Map<String, Collection<ValidationTask>> initializeTargetTasks() {
    Map<String, Collection<ValidationTask>> targetMap = new TreeMap<>();
    List<ValidationTask> allMasterTasks = new ArrayList<>(COMMON_TASKS);
    allMasterTasks.addAll(MASTER_TASKS);
    targetMap.put("master", allMasterTasks);
    List<ValidationTask> allWorkerTasks = new ArrayList<>(COMMON_TASKS);
    allWorkerTasks.addAll(WORKER_TASKS);
    targetMap.put("worker", allWorkerTasks);
    targetMap.put("local", TASKS.keySet());
    targetMap.put("cluster", new ArrayList<>(CLUSTER_TASKS));
    return targetMap;
}