Java ArrayList Create createArrayList(String[] a)

Here you can find the source of createArrayList(String[] a)

Description

create Array List

License

Open Source License

Declaration

public static ArrayList<String> createArrayList(String[] a) 

Method Source Code


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

import java.util.ArrayList;

public class Main {
    public static ArrayList<String> createArrayList(String[] a) {
        ArrayList<String> b = new ArrayList<String>();
        for (int i = 0; i < a.length; i++) {
            b.add(a[i]);//from  ww w.  ja v a2  s.co m
        }
        return b;
    }

    public static ArrayList<Integer> createArrayList(int[] a) {
        ArrayList<Integer> b = null;
        for (int i = 0; i < a.length; i++) {
            b.add(a[i]);
        }
        return b;
    }

    public static ArrayList<Float> createArrayList(float[] a) {
        ArrayList<Float> b = null;
        for (int i = 0; i < a.length; i++) {
            b.add(a[i]);
        }
        return b;
    }
}

Related

  1. createArrayList(Collection arg)
  2. createArrayList(E... array)
  3. createArrayList(final DataType first, final DataType second)
  4. createArrayList(Iterable items, int size)
  5. createArrayList(Object[] a)
  6. createArrayList(T... objects)
  7. createArrayListFilledIncrement(int count)
  8. createArrayListOfArrayList(int size)
  9. getArrayList()