Java ArrayList Create newArrayList()

Here you can find the source of newArrayList()

Description

new Array List

License

Apache License

Declaration

public static <T> ArrayList<T> newArrayList() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import java.util.Collections;

public class Main {

    public static <T> ArrayList<T> newArrayList() {
        return new ArrayList<T>();
    }/*from w ww  .  jav a 2  s .c  o m*/

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

    public static <T> ArrayList newArrayList(T... ele) {
        ArrayList list = null;
        if (null != ele && 0 != ele.length) {
            list = newArrayList(ele.length);
            Collections.addAll(list, ele);
        }
        return list;
    }
}

Related

  1. newArrayList()
  2. newArrayList()
  3. newArrayList()
  4. newArrayList()
  5. newArrayList()
  6. newArrayList()
  7. newArrayList(A... elements)
  8. newArrayList(Collection c)
  9. newArrayList(Collection collection)