Example usage for java.util ArrayList addAll

List of usage examples for java.util ArrayList addAll

Introduction

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

Prototype

public 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.

Usage

From source file:com.piggate.sdk.PiggateInfo.java

public static ArrayList<PiggateInfo> getInfo() {
    Lock l = rwLock2.readLock();//from  w  ww.  j ava  2  s.com
    ArrayList<PiggateInfo> result = new ArrayList<PiggateInfo>();
    l.lock();
    try {
        result.addAll(internal_info);
    } catch (Exception ex) {
    } finally {
        l.unlock();
    }
    return result;
}

From source file:info.dolezel.fatrat.plugins.helpers.NativeHelpers.java

public static Class[] findAnnotatedClasses(String packageName, Class annotation)
        throws IOException, ClassNotFoundException {
    String path = packageName.replace('.', '/');
    Enumeration<URL> resources = loader.getResources(path);
    Set<File> dirs = new HashSet<File>();
    while (resources.hasMoreElements()) {
        URL resource = resources.nextElement();
        dirs.add(new File(resource.getFile()));
    }//  ww w.j a  v a2 s. c  om
    for (URL url : loader.getURLs()) {
        dirs.add(new File(url.getFile()));
    }

    ArrayList<Class> classes = new ArrayList<Class>();
    for (File directory : dirs) {
        classes.addAll(findClasses(directory, packageName, annotation));
    }

    return classes.toArray(new Class[classes.size()]);
}

From source file:com.ibm.rtc.automation.examples.client.RTCUserUtil.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public static void listUsers(ITeamRepository repo) throws TeamRepositoryException {
    IContributorManager icm = repo.contributorManager();
    List allContribs = icm.fetchAllContributors(null);
    //System.out.println(allContribs.size());
    ArrayList clone = new ArrayList();
    clone.addAll(allContribs);
    Collections.sort(clone, new UserComparator());

    int allContribSize = clone.size();
    for (int i = 0; i < allContribSize; i++) {
        IContributor user = (IContributor) clone.get(i);

        System.out.println(user.getName());
    }//from   w w  w. j a  v  a 2 s  .  co m
    System.out.println("There are " + allContribSize + " total users in the repository");
}

From source file:com.ibm.rtc.automation.examples.client.RTCUserUtil.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public static void listUsersEmail(ITeamRepository repo) throws TeamRepositoryException {
    IContributorManager icm = repo.contributorManager();
    List allContribs = icm.fetchAllContributors(null);
    //System.out.println(allContribs.size());
    ArrayList clone = new ArrayList();
    clone.addAll(allContribs);
    Collections.sort(clone, new UserComparator());

    int allContribSize = clone.size();
    for (int i = 0; i < allContribSize; i++) {
        IContributor user = (IContributor) clone.get(i);
        if (!user.isArchived()) {
            System.out.println(user.getUserId() + " ," + user.getEmailAddress());
        }//  w  w w .  ja v a2 s.  co m
    }
    System.out.println("There are " + allContribSize + " total users in the repository");
}

From source file:com.dtolabs.rundeck.core.utils.ScriptExecUtil.java

private static void addQuotedArgs(Map<String, Map<String, String>> localDataContext, INodeEntry node,
        String scriptargs, String[] scriptargsarr, ArrayList<String> arglist, boolean quoted) {
    if (null != scriptargs) {
        arglist.addAll(
                Arrays.asList(DataContextUtils.replaceDataReferences(scriptargs.split(" "), localDataContext)));
    } else if (null != scriptargsarr) {
        if (!quoted) {
            arglist.addAll(Arrays.asList(scriptargsarr));
        } else {//from  w  w w.j a  va  2  s.  co m
            final String[] newargs = DataContextUtils.replaceDataReferences(scriptargsarr, localDataContext);
            Converter<String, String> quote = getQuoteConverterForNode(node);
            //quote args that have substituted context input, or have whitespace
            //allow other args to be used literally
            for (int i = 0; i < newargs.length; i++) {
                String replaced = newargs[i];
                if (null != quote && (!replaced.equals(scriptargsarr[i]) || CLIUtils.containsSpace(replaced))) {
                    arglist.add(quote.convert(replaced));
                } else {
                    arglist.add(replaced);
                }
            }
        }
    }
}

From source file:IO.Directories.java

/**
 * Return ArrayList<File> filed with File objects represent the files in the
 * given folder//from   w ww. j  ava2 s .c  om
 *
 * @param folder_path path of a folder
 * @return ArrayList<File> filed with File objects represent the files in
 * the given folder
 */
public static ArrayList<File> GetFolderFiles(String folderPath) {
    ArrayList<File> filesPaths = new ArrayList<>();
    File directory = new File(folderPath);
    if (directory.exists()) {
        File[] directoryFiles = directory.listFiles();
        filesPaths.addAll(Arrays.asList(directoryFiles));
    }
    return filesPaths;
}

From source file:com.livinglogic.ul4.MulAST.java

public static List call(int arg1, List arg2) {
    ArrayList result = new ArrayList();

    for (; arg1 > 0; --arg1)
        result.addAll(arg2);
    return result;
}

From source file:com.livinglogic.ul4.MulAST.java

public static List call(long arg1, List arg2) {
    ArrayList result = new ArrayList();

    for (; arg1 > 0; --arg1)
        result.addAll(arg2);
    return result;
}

From source file:com.searchbox.core.ref.ReflectionUtils.java

public static List<Field> findAllFields(Class<?> element) {
    ArrayList<Field> fields = new ArrayList<Field>();
    if (element != null) {
        for (Field field : element.getDeclaredFields()) {
            fields.add(field);/*  www  .  j  ava2s. c  om*/
        }
        fields.addAll(findAllFields(element.getSuperclass()));
        return fields;
    } else {
        return Collections.emptyList();
    }
}

From source file:com.dtolabs.rundeck.core.utils.ScriptExecUtil.java

/**
 * Generate argument array for a script file invocation
 *
 * @param localDataContext      data context properties to expand among the args
 * @param node                  node to use for os-type argument quoting.
 * @param scriptargs            arguments to the script file
 * @param scriptargsarr         arguments to the script file as an array
 * @param scriptinterpreter     interpreter invocation for the file, or null to invoke it directly
 * @param interpreterargsquoted if true, pass the script file and args as a single argument to the interpreter
 * @param filepath              remote filepath for the script
 *///from  ww  w  . j a v a 2  s. c  o m
public static String[] createScriptArgs(final Map<String, Map<String, String>> localDataContext,
        final INodeEntry node, final String scriptargs, final String[] scriptargsarr,
        final String scriptinterpreter, final boolean interpreterargsquoted, final String filepath) {
    final ArrayList<String> arglist = new ArrayList<String>();
    if (null != scriptinterpreter) {
        arglist.addAll(Arrays.asList(OptsUtil.burst(scriptinterpreter)));
    }
    if (null != scriptinterpreter && interpreterargsquoted) {
        final ArrayList<String> sublist = new ArrayList<String>();
        sublist.add(filepath);
        addQuotedArgs(localDataContext, node, scriptargs, scriptargsarr, sublist, true);
        arglist.add(DataContextUtils.join(sublist, " "));
    } else {
        arglist.add(filepath);
        addQuotedArgs(localDataContext, node, scriptargs, scriptargsarr, arglist, false);
    }
    return arglist.toArray(new String[arglist.size()]);
}