Java Array to List toList(Object[] array)

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

Description

Converts the supplied object list into an ArrayList

License

Open Source License

Parameter

Parameter Description
array a parameter

Return

array list or null

Declaration

public static ArrayList toList(Object[] array) 

Method Source Code


//package com.java2s;

import java.util.ArrayList;

public class Main {
    /**//  www .j  a  v  a2 s.  c  o m
     * Converts the supplied object list into an ArrayList
     * 
     * @param array
     * @return array list or null
     */
    public static ArrayList toList(Object[] array) {
        if (array == null) {
            return null;
        }
        final int len = array.length;
        ArrayList rs = new ArrayList(len);
        for (int i = 0; i < len; i++) {
            rs.add(array[i]);
        }
        return rs;
    }
}

Related

  1. toList(int[] array)
  2. toList(int[] from)
  3. toList(Object[] arr)
  4. toList(Object[] array)
  5. toList(Object[] array)
  6. toList(Object[] array)
  7. toList(Object[] array)
  8. toList(Object[] data)
  9. toList(Object[] input)