Java List Create createListWithArray(Object[] array)

Here you can find the source of createListWithArray(Object[] array)

Description

Create a new array list with input array.

License

Open Source License

Parameter

Parameter Description
array Object[]

Return

List

Declaration

public static List<Object> createListWithArray(Object[] array) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;
import java.util.List;

public class Main {
    /**//from  w ww. j av  a2s .  c om
     * Create a new array list with input array.
     * 
     * @param array Object[]
     * @return List
     */
    public static List<Object> createListWithArray(Object[] array) {
        final ArrayList<Object> result = new ArrayList<Object>();
        if (array == null) {
            return result;
        }
        for (Object obj : array) {
            result.add(obj);
        }
        return result;
    }
}

Related

  1. createListFromDotSeparatedString(String s)
  2. createListFromList(Collection collection)
  3. createListOfObjects(T... elements)
  4. createListOfOneItem(Object item)
  5. createListOfValidNumberOfPoints(int[] terms, int min, int max)
  6. createListWithObjects(Object... objects)
  7. createMapFromList(List list)
  8. createMapOfObjects(List keys, List values)
  9. createMatrix(List source, List target)