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

ListArrayToList(String[] input)
Array To List
if (input == null) {
    return null;
List<String> output = new ArrayList<String>();
for (int i = 0; i < input.length; i++) {
    output.add(input[i]);
return output;
...
ListarrayToList(String[] str)
array To List
List list = Arrays.asList(str);
return list;
ArrayListarrayToList(T array[])
array To List
if (null == array) {
    return null;
return new ArrayList<T>(Arrays.asList(array));
ListarrayToList(T[] array)
Array to List converter
List<T> list = new ArrayList<T>(); 
if (array != null) {
    for (T element : array) {
        list.add(element); 
return list;
ArrayListarrayToList(T[] array)
Converts the generic array into an ArrayList of the same type.
ArrayList<T> list = new ArrayList<T>(array.length);
for (T element : array) {
    list.add(element);
return list;
ListarrayToList(T[] array)
array To List
return isArrayEmpty(array) ? new ArrayList<T>(1) : Arrays.asList(array);
ArrayListarrayToList(T[] array)
Converts the generic array into an ArrayList of the same type.
ArrayList<T> list = new ArrayList<>(array.length);
Collections.addAll(list, array);
return list;
ListarrayToList(T[] array)
array To List
List<T> list = new ArrayList<T>();
if (array == null || array.length == 0) {
    return list;
for (T t : array) {
    list.add(t);
return list;
...
ListarrayToList(T[] obj, List newList)
array To List
if (obj == null)
    return null;
List<T> lists = newList;
for (int i = 0; i < obj.length; i++) {
    lists.add(obj[i]);
return lists;
ListarrayToList(T[] source)
Convert the supplied array into a List.
return Arrays.asList(source);