Create new Array List - Java java.util

Java examples for java.util:List Creation

Description

Create new Array List

Demo Code


//package com.java2s;

import java.util.ArrayList;
import java.util.Collection;

public class Main {
    public static void main(String[] argv) {
        System.out.println(newArrayList());
    }//from   w  w  w.  j  av a 2s .co m

    public static <E> ArrayList<E> newArrayList() {
        return new ArrayList<E>();
    }

    public static <E> ArrayList<E> newArrayList(
            final Collection<? extends E> c) {
        return new ArrayList<E>(c);
    }

    public static <E> ArrayList<E> newArrayList(final int initialCapacity) {
        return new ArrayList<E>(initialCapacity);
    }
}

Related Tutorials