Here you can find the source of newArrayList(int initialCapacity)
Parameter | Description |
---|---|
T | a parameter |
initialCapacity | a parameter |
public static <T> List<T> newArrayList(int initialCapacity)
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { /**//ww w . j av a 2s .com * Constructs an empty list with the specified initial capacity. * * @param <T> * @param initialCapacity * @return */ public static <T> List<T> newArrayList(int initialCapacity) { return new ArrayList<T>(initialCapacity); } /** * Constructs an empty list with an initial capacity of ten. * * @param <T> * @return */ public static <T> List<T> newArrayList() { return newArrayList(10); } /** * @param enemyList * @return */ public static <T> List<T> newArrayList(List<T> c) { return new ArrayList<T>(c); } }