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:Main.java

public static <T> List<T> modifiableListOf(T... elements) {
    List<T> l = new ArrayList<T>();
    l.addAll(Arrays.asList(elements));
    return l;// w  ww.j  ava 2s .  c o  m
}

From source file:Main.java

public static <T> List<T> toList(Set<T> set) {
    List<T> list = new ArrayList<T>();
    list.addAll(set);
    return list;/*  www  . j  a v  a2 s.c om*/
}

From source file:Main.java

public static <T> List<T> collectionToList(Collection<T> collection) {
    List<T> list = new ArrayList<T>();
    list.addAll(collection);
    return list;//from w w  w .  j av  a 2 s . c  om
}

From source file:Main.java

public static <T> List<T> toList(Collection<T> cl) {

    List<T> rt = new ArrayList<T>();
    rt.addAll(cl);
    return rt;/*from   w ww.  j  av  a2  s .  c om*/

}

From source file:Main.java

public static <T> List<T> union(final Collection<T> a, final Collection<T> b, Object object) {
    List<T> result = new ArrayList<T>(a);
    result.addAll(b);
    return result;
}

From source file:Main.java

public static <T> List<T> asList(T... elements) {
    List<T> toReturn = new ArrayList<>();
    toReturn.addAll(Arrays.asList(elements));
    return toReturn;
}

From source file:Main.java

public static <T> List<T> setToList(Set<T> set) {
    List<T> list = new ArrayList<>(set.size());
    list.addAll(set);
    return list;//from  w  ww .jav  a 2 s  .co m
}

From source file:Main.java

public static <T> List<T> switchSet2List(Set<T> a) {
    List<T> list = new ArrayList<T>();
    list.addAll(a);
    return list;/*w w  w. j  a  va  2s. c o  m*/
}

From source file:Main.java

public static <T> List<T> concatenate(Collection<? extends T> a, Collection<? extends T> b) {
    List<T> list = new ArrayList<T>();
    list.addAll(a);
    list.addAll(b);//from   w  ww .  j a v  a 2 s.  c  o m
    return list;
}

From source file:Main.java

public static <T> List<T> add(List<T> list, T a) {
    List<T> newList = newEmptyList();
    newList.addAll(list);
    newList.add(a);//from   www. jav a 2  s.  c o m
    return newList;
}