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:net.datenwerke.transloader.ClassWrapper.java

private static boolean classIsAssignableToType(Class rootClass, String typeName) {
    List allClasses = new ArrayList();
    allClasses.add(rootClass);/*from  w w w . j av  a  2s  .co  m*/
    allClasses.addAll(ClassUtils.getAllSuperclasses(rootClass));
    allClasses.addAll(ClassUtils.getAllInterfaces(rootClass));
    List allClassNames = ClassUtils.convertClassesToClassNames(allClasses);
    return allClassNames.contains(typeName);
}

From source file:com.personal.tools.Collections3.java

/**
 * a+bList.// w  ww .  j  av a2s .  co m
 */
public static <T> List<T> union(final Collection<T> a, final Collection<T> b) {
    List<T> result = new ArrayList<>(a);
    result.addAll(b);
    return result;
}

From source file:Main.java

public static JComponent[] getAllSubComponents(Container root) {
    List<JComponent> comps = new LinkedList<JComponent>();
    for (Component c : root.getComponents()) {
        try {/* w w  w .j  a  v a 2 s  . c  om*/
            comps.add((JComponent) c);
            comps.addAll(Arrays.asList(getAllSubComponents((JComponent) c)));
        } catch (final ClassCastException e) {
            continue;
        }
    }
    return comps.toArray(new JComponent[comps.size()]);
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.publico.ReadAllStudentsAndGroups.java

private static List getAllStudentGroups(Grouping groupProperties) {
    List result = new ArrayList();
    Collection studentGroups = groupProperties.getStudentGroupsSet();
    result.addAll(studentGroups);
    return result;
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.publico.ReadStudentsAndGroupsWithoutShift.java

private static List getStudentGroupsWithoutShiftByGroupProperties(Grouping groupProperties) {
    List result = new ArrayList();
    List studentGroups = groupProperties.getStudentGroupsWithoutShift();
    result.addAll(studentGroups);
    return result;
}

From source file:io.rhiot.cloudplatform.service.binding.OperationBinding.java

static OperationBinding operationBinding(PayloadEncoding payloadEncoding, String channel,
        byte[] incomingPayload, Map<String, Object> headers, Registry registry) {
    String rawChannel = channel.substring(channel.lastIndexOf('/') + 1);
    String[] channelParts = rawChannel.split("\\.");
    String service = channelParts[0];
    String operation = channelParts[1];

    List<Object> arguments = new LinkedList<>(asList(channelParts).subList(2, channelParts.length));

    for (Map.Entry<String, Object> header : headers.entrySet()) {
        if (header.getKey().startsWith("RHIOT_ARG")) {
            arguments.add(header.getValue());
        }/*from w  w w.j a  v a2  s. c o  m*/
    }

    Object bean = registry.lookupByName(service);
    Validate.notNull(bean, "Cannot find service with name '%s'.", service);
    Class beanType = bean.getClass();

    LOG.debug("Detected service bean type {} for operation: {}", beanType, operation);
    List<Method> beanMethods = new ArrayList<>(asList(beanType.getDeclaredMethods()));
    beanMethods.addAll(asList(beanType.getMethods()));
    Method operationMethod = beanMethods.stream().filter(method -> method.getName().equals(operation)).findAny()
            .get();

    if (incomingPayload != null && incomingPayload.length > 0) {
        Object payload = incomingPayload;
        if (operationMethod.getParameterTypes()[operationMethod.getParameterTypes().length
                - 1] != byte[].class) {
            payload = payloadEncoding.decode(incomingPayload);
        }
        arguments.add(payload);
    }
    return new OperationBinding(service, operation, arguments, operationMethod);
}

From source file:models.CommitComment.java

public static List<CommitComment> findByCommits(Project project, List<PullRequestCommit> commits) {
    List<CommitComment> list = new ArrayList<>();
    for (PullRequestCommit commit : commits) {
        list.addAll(CommitComment.find.where().eq("project.id", project.id).eq("commitId", commit.getCommitId())
                .setOrderBy("createdDate asc").findList());
    }//w  w w . j  a va2  s  .  c  om
    return list;
}

From source file:Main.java

public static List<String> checkMapDiff(Map<String, List<String>> m1, Map<String, List<String>> m2) {
    List<String> diff = new ArrayList<>();
    //m2-m1/*from www. j a v a 2  s . c om*/
    for (String k : m1.keySet()) {
        if (m2.containsKey(k)) {
            diff.addAll(getDiff(m1.get(k), m2.get(k)));
        } else {//m1 have, but m2 don't
            diff.addAll(m1.get(k));
        }
    }

    //m1-m2
    for (String k : m2.keySet()) {
        if (!m1.containsKey(k)) {//m2 have, but m1 don't
            diff.addAll(m2.get(k));
        }
    }

    return diff;
}

From source file:com.dragovorn.dragonbot.api.bot.file.FileManager.java

public static void reloadFiles() {
    FileManager.config = new File(directory, "config.yml");
    FileManager.logs = new File(directory, "logs");
    FileManager.plugins = new File(directory, "plugins");
    FileManager.updater = new File(directory, "updater.jar");

    List<File> toCopy = new ArrayList<>();

    toCopy.addAll(pluginAddedFiles);

    pluginAddedFiles.clear();/*from ww  w . j av  a2 s  .c  o  m*/

    toCopy.forEach(file -> {
        try {
            if (file.isDirectory()) {
                FileUtils.copyDirectory(file, new File(directory, file.getName()));
            } else {
                FileUtils.copyFile(file, new File(directory, file.getName()));
            }

            file.delete();

            pluginAddedFiles.add(new File(directory, file.getName()));
        } catch (IOException exception) {
            exception.printStackTrace();
        }
    });
}

From source file:com.firewallid.util.FIUtils.java

public static <L> List<L> combineList(List<L> l1, List<L> l2) {
    List<L> l1tmp = new ArrayList<>(l1);
    List<L> l2tmp = new ArrayList<>(l2);
    l1tmp.addAll(l2tmp);
    return new ArrayList<>(l1tmp);
}