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

ArrayList[]newArrayOfEmptyArrayList(int len)
Create an array of len empty ArrayLists.
ArrayList[] result = new ArrayList[len];
for (int i = 0; i < len; i++) {
    result[i] = new ArrayList<>();
return result;
ArrayListsizedArrayList(final int size)
Returns a sized array list of type T .
return new ArrayList<T>(size);
ListsizedArrayList(int capacity)
sized Array List
return new ArrayList<>(capacity);
ArrayListstringToArrayList(String s, String sep)
string To Array List
String[] stringArray = s.split(sep);
ArrayList<String> stringList = new ArrayList<String>();
for (String string : stringArray) {
    stringList.add(string);
return stringList;
ArrayListstringToArrayList(String string)
Convert a String with values separates by comma to ArrayList
ArrayList<String> arrayList = new ArrayList<String>();
if (string != null && string.length() > 0) {
    String[] tabValeur = string.split(",");
    for (int i = 0; i < tabValeur.length; i++) {
        arrayList.add(tabValeur[i].trim());
return arrayList;
...
ArrayListtoArrayList(int[] intValues)
to Array List
if (intValues == null) {
    return new ArrayList<Integer>();
ArrayList<Integer> values = new ArrayList<Integer>(intValues.length);
for (int i = 0; i < intValues.length; i++) {
    values.add(new Integer(intValues[i]));
return values;
...
ArrayListtoArrayList(Iterator ii, int initial_capacity)
to Array List
ArrayList out = new ArrayList(initial_capacity);
while (ii.hasNext())
    out.add(ii.next());
return out;
ListtoArrayList(String[] stringArray)
Creates a new ArrayList, containing the elements of a supplied array of String objects.
List<String> strings = new ArrayList<>();
if (null == stringArray) {
    return strings;
Collections.addAll(strings, stringArray);
return strings;