Java ArrayList Create toArrayList(int[] intValues)

Here you can find the source of toArrayList(int[] intValues)

Description

to Array List

License

Open Source License

Declaration

public static ArrayList<Integer> toArrayList(int[] intValues) 

Method Source Code


//package com.java2s;
/*/*from   w  w w  .  j  a v  a 2s. c  o  m*/
 * Copyright 2000-2013 Enonic AS
 * http://www.enonic.com/license
 */

import java.util.*;

public class Main {
    public static ArrayList<Integer> toArrayList(int[] intValues) {
        if (intValues == null) {
            return new ArrayList<Integer>();
        }

        ArrayList<Integer> values = new ArrayList<Integer>(intValues.length);
        for (int i = 0; i < intValues.length; i++) {
            values.add(new Integer(intValues[i]));
        }
        return values;
    }
}

Related

  1. newArrayOfEmptyArrayList(int len)
  2. sizedArrayList(final int size)
  3. sizedArrayList(int capacity)
  4. stringToArrayList(String s, String sep)
  5. stringToArrayList(String string)
  6. toArrayList(Iterator ii, int initial_capacity)
  7. toArrayList(String[] stringArray)