Here you can find the source of array2List(Object[] obj)
Parameter | Description |
---|---|
obj | Array of objects to be placed in List |
public static List array2List(Object[] obj)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { /**// w w w .j a v a 2s . c o m * Converts an Object[] to a List. If null Object[] is provided, an empty * List is returned. * * @param obj * Array of objects to be placed in List * @return List of objects */ public static List array2List(Object[] obj) { ArrayList list = new ArrayList(); if (obj != null) { for (int i = 0; i < obj.length; i++) { list.add(obj[i]); } } return (list); } }