Java Utililty Methods ArrayList Create

List of utility methods to do ArrayList Create

Description

The list of methods to do ArrayList Create are organized into topic(s).

Method

ListnewArrayList(E... elements)
new Array List
ArrayList<E> list = new ArrayList<E>(elements.length);
Collections.addAll(list, elements);
return list;
ArrayListnewArrayList(E... elements)
Creates a new ArrayList with the provided elements.
return new ArrayList<>(Arrays.asList(elements));
ListnewArrayList(final Collection elements)
Create an ArrayList Object.
return new ArrayList<E>(elements);
ListnewArrayList(final Iterator iter)
new Array List
if (!iter.hasNext()) {
    return Collections.emptyList();
final List<T> result = new ArrayList<T>();
while (iter.hasNext()) {
    result.add(iter.next());
return result;
...
ListnewArrayList(int initialCapacity)
Constructs an empty list with the specified initial capacity.
return new ArrayList<T>(initialCapacity);
ArrayListnewArrayList(int initialCapacity)
new Array List
return new ArrayList<E>(initialCapacity);
ArrayListnewArrayList(int initialCapacity)
Construct and return new epmty ArrayList with given initial capacity.
return new ArrayList<T>(initialCapacity);
ArrayListnewArrayList(int initialCapacity)
new Array List
return new ArrayList<T>(initialCapacity);
ListnewArrayList(int size)
Create new ArrayList .
return new ArrayList<L>(size);
ArrayListnewArrayList(Iterable elements)
new Array List
if (elements instanceof Collection) {
    Collection<? extends E> collection = (Collection<? extends E>) elements;
    return new ArrayList<E>(collection);
} else {
    return newArrayList(elements.iterator());