Java ArrayList Create createArrayList(T... objects)

Here you can find the source of createArrayList(T... objects)

Description

Initializes an ArrayList with objects.

License

Open Source License

Declaration

public static <T> ArrayList<T> createArrayList(T... objects) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.Collections;

public class Main {
    /**//from   w w w.j  a  v  a2s.  c  o m
     * Initializes an ArrayList with objects.
     * */
    public static <T> ArrayList<T> createArrayList(T... objects) {
        ArrayList<T> arrayList = new ArrayList<T>();

        Collections.addAll(arrayList, objects);

        return arrayList;
    }
}

Related

  1. createArrayList(E... array)
  2. createArrayList(final DataType first, final DataType second)
  3. createArrayList(Iterable items, int size)
  4. createArrayList(Object[] a)
  5. createArrayList(String[] a)
  6. createArrayListFilledIncrement(int count)
  7. createArrayListOfArrayList(int size)
  8. getArrayList()
  9. getArrayList()