Java Utililty Methods List from Array

List of utility methods to do List from Array

Description

The list of methods to do List from Array are organized into topic(s).

Method

ListconvertArrayToList(Object[] source)
convert Array To List
List<Object> list = new ArrayList<Object>(source.length);
for (Object element : source) {
    list.add(element);
return list;
ListconvertArrayToList(String[] array)
convert Array To List
List<String> list = new ArrayList<>(Arrays.asList(array));
return list;
ArrayListconvertArrayToList(String[] array)
Convert array to list of objects.
ArrayList<String> elemList = new ArrayList<String>();
for (String element : array) {
    elemList.add(element);
return elemList;
voidconvertArrayToList(String[] arrayStr)
convert Array To List
List<String> strL = Arrays.asList(arrayStr);
System.out.println("------" + strL.size());
ListconvertArrayToList(T... objects)
convert Array To List
if (objects == null)
    return null;
List<T> list = new ArrayList<T>();
for (T object : objects)
    list.add(object);
return list;
ListconvertArrayToList(T[] array)
convert Array To List
return Arrays.asList(array);
ListconvertArrayToList(T[] arrayOfObjects)
convert Array To List
final ArrayList<T> list = new ArrayList<T>();
Collections.addAll(list, arrayOfObjects);
return list;
ListcopyToList(T... items)
copy To List
return new ArrayList<T>(Arrays.asList(items));
ListcopyToList(T[] array)
Copy the given array to a dynamic List .
List<T> list = new ArrayList<T>(array.length);
for (T elem : array) {
    list.add(elem);
return list;