Java Array to ArrayList arrayToArrayList(Object[] myArray)

Here you can find the source of arrayToArrayList(Object[] myArray)

Description

This method converts an array into an ArrayList.

License

Open Source License

Parameter

Parameter Description
myArray a parameter

Declaration

static public ArrayList arrayToArrayList(Object[] myArray) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    /**/*from w w  w . j av a  2s  .c o m*/
     * This method converts an array into an ArrayList.
     * 
     * @param myArray
     * @return
     */
    static public ArrayList arrayToArrayList(Object[] myArray) {

        int i = 0;

        ArrayList out = new ArrayList();

        for (i = 0; i < myArray.length; i++) {
            Object extract = myArray[i];
            out.add(extract);
        }
        return (out);
    }
}

Related

  1. arrayToArrayList(Object aobj[])
  2. arrayToArrayList(Object[] array)
  3. arrayToArraylist(String[] array)
  4. arrayToArrayList(T[] array)
  5. arrayToArraylist(T[] array)
  6. asArrayList(Collection c)