Here you can find the source of newArrayList()
public static <T> ArrayList<T> newArrayList()
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Iterator; public class Main { public static <T> ArrayList<T> newArrayList() { ArrayList<T> newArrayList = new ArrayList<T>(); return newArrayList; }/* ww w .j a va 2 s .c o m*/ public static <T> ArrayList<T> newArrayList(Iterator<T> iterator) { ArrayList<T> newArrayList = new ArrayList<T>(); while (iterator.hasNext()) { newArrayList.add(iterator.next()); } return newArrayList; } public static <T> ArrayList<T> newArrayList(Iterable<T> iterable) { ArrayList<T> newArrayList = new ArrayList<T>(); for (T element : iterable) { newArrayList.add(element); } return newArrayList; } public static <T> ArrayList<T> newArrayList(T[] values) { ArrayList<T> newArrayList = new ArrayList<T>(); if (values == null) { return newArrayList; } for (T element : values) { newArrayList.add(element); } return newArrayList; } @SafeVarargs public static <T> ArrayList<T> newArrayList(T element0, T element1, T... elements) { ArrayList<T> newArrayList = new ArrayList<T>(); newArrayList.add(element0); newArrayList.add(element1); for (T element : elements) { newArrayList.add(element); } return newArrayList; } }