Java List from Array asList(int[] values)

Here you can find the source of asList(int[] values)

Description

as List

License

Open Source License

Declaration

public static ArrayList<Integer> asList(int[] values) 

Method Source Code


//package com.java2s;
/* @(#)ArrayUtil.java//  w  w w.j a  va 2s  . c  o  m
 *
 * Copyright (c) 2003 Werner Randelshofer, Switzerland. MIT License.
 *
 * Implementation derived from Sun's Java 1.4 VM.
 */

import java.util.ArrayList;

public class Main {
    public static ArrayList<Integer> asList(int[] values) {
        if (values == null) {
            return null;
        }
        ArrayList<Integer> list = new ArrayList<Integer>(values.length);
        for (int i = 0; i < values.length; i++) {
            list.add(new Integer(values[i]));
        }
        return list;
    }
}

Related

  1. asList(int[] ai)
  2. asList(int[] ar)
  3. asList(int[] arr)
  4. asList(int[] ints)
  5. asList(int[] list)
  6. asList(Iterable iterable)
  7. asList(Iterable iterable)
  8. asList(Iterable iterable)
  9. asList(Iterable iterable)