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:io.fabric8.maven.core.util.ProfileUtil.java

private static List<Profile> readProfileFromClasspath(String name) throws IOException {
    List<Profile> ret = new ArrayList<>();
    ret.addAll(readAllFromClasspath(name, "default"));
    ret.addAll(readAllFromClasspath(name, ""));
    return ret;/*from  w w w .  ja va  2s.co m*/
}

From source file:Main.java

public static List getChildJComponents(Container container) {
    List result = new ArrayList();

    Component[] children = container.getComponents();

    for (int i = 0; i < children.length; i++) {
        if (children[i] instanceof JComponent) {
            result.add(children[i]);/*from w ww  .ja va 2s.  c  o m*/
            result.addAll(getChildJComponents((JComponent) children[i]));
        }
    }

    return result;
}

From source file:com.darkstar.beanCartography.utils.NameUtils.java

/**
 * Return public, private, protected, etc. fields declared by the passed
 * class in a field array./*w ww .j  a  v a  2  s  .  c  o m*/
 *
 * @param clazz class to inspect
 * @param includeSuperClasses <code>true</code> will cause superclasses to be included in the field collection
 * @return array of Fields found
 */
public static Field[] getClassFields(Class<?> clazz, boolean includeSuperClasses) {
    Preconditions.checkNotNull(clazz, "Class cannot be null!");
    List<Field> allFields = new ArrayList<>();
    do {
        allFields.addAll(Arrays.asList(clazz.getDeclaredFields()));
    } while (includeSuperClasses && (clazz = clazz.getSuperclass()) != null);

    Field[] fields = new Field[allFields.size()];
    return allFields.toArray(fields);
}

From source file:me.vertretungsplan.parser.ParserUtils.java

static List<String> handleUrlsWithDateFormat(List<String> urls) {
    List<String> urlsWithDate = new ArrayList<>();
    for (String url : urls) {
        urlsWithDate.addAll(handleUrlWithDateFormat(url));
    }// w w w.  j  a v a 2  s  .c om
    return urlsWithDate;
}

From source file:com.tulskiy.musique.system.configuration.PlaylistConfiguration.java

public static List<Playlist> getPlaylists(List<Playlist> def) {
    List<Playlist> playlists = getPlaylists();

    if (CollectionUtils.isEmpty(playlists)) {
        playlists.addAll(def);
    }/*  ww  w  . j a  v a  2s  . c  om*/

    return playlists;
}

From source file:de.micromata.tpsb.doc.renderer.RendererClassUtils.java

private static void initProjectClassPaths(List<String> cplist) {
    TpsbProjectCatalog catalog = TpsbProjectCatalog.getInstance();
    List<String> cps = catalog.getProjectCps();
    cplist.addAll(cps);
}

From source file:fi.kela.kanta.util.GenericToString.java

public static List<Field> getAllFields(Class<?> type) {
    List<Field> fields = new ArrayList<Field>();
    for (Class<?> c = type; c != null; c = c.getSuperclass()) {
        fields.addAll(Arrays.asList(c.getDeclaredFields()));
    }//  ww w  .  j a  v a  2 s  . c  om
    return fields;
}

From source file:Main.java

/**
 * Get files of directory you passed. The files contains files of passed directory's sub directory by recursive exploring.
 *///from   ww w . j a va  2 s  .com
public static List<File> getAllFiles(File directory) {
    final List<File> fileList = new LinkedList<File>();
    final File[] files = directory.listFiles();

    if (files == null)
        return fileList;
    for (File file : files) {
        if (file.isDirectory())
            fileList.addAll(getAllFiles(file));
        else
            fileList.add(file);
    }
    return fileList;
}

From source file:Main.java

public static <T> List<T> intersection(Collection<? extends Collection<T>> availableValuesByDescriptor) {
    List<T> result = new ArrayList<T>();
    Iterator<? extends Collection<T>> iterator = availableValuesByDescriptor.iterator();
    if (iterator.hasNext()) {
        Collection<T> firstSet = iterator.next();
        result.addAll(firstSet);
        while (iterator.hasNext()) {
            Collection<T> next = iterator.next();
            result.retainAll(next);/*w  ww  .  j a  va2s. co m*/
        }
    }
    return result;

}

From source file:com.civprod.util.ChainListWrapper.java

public static <T> List<T> createList(Collection<T> inList) {
    java.util.function.Supplier<List<T>> SupplierFun = () -> {
        return org.apache.commons.collections4.list.SetUniqueList.setUniqueList(new ArrayList<T>());
    };//from  w w  w .  j a  v  a2s . co  m
    List<T> rList = inList.parallelStream().collect(SupplierFun, (List<T> coll, T curItem) -> {
        if (curItem instanceof ChainListWrapper) {
            coll.addAll(createList((ChainListWrapper) curItem));
        } else {
            coll.add(curItem);
        }
    }, List<T>::addAll);
    return rList;
}