Java List from Array asList(int[] a)

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

Description

as List

License

Open Source License

Declaration

public static List<Integer> asList(int[] a) 

Method Source Code

//package com.java2s;

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<Integer> asList(int[] a) {
        List<Integer> result = new ArrayList<Integer>(a.length);
        for (int i = 0; i < a.length; i++) {
            result.add(Integer.valueOf(a[i]));
        }/*w  ww  . j a v  a2s .  c  om*/
        return result;
    }

    public static List<Double> asList(double[] a) {
        List<Double> result = new ArrayList<Double>(a.length);
        for (int i = 0; i < a.length; i++) {
            result.add(new Double(a[i]));
        }
        return result;
    }
}

Related

  1. asList(final T[] input)
  2. asList(float[] elements)
  3. asList(int... array)
  4. asList(int... data)
  5. asList(int... values)
  6. asList(int[] ai)
  7. asList(int[] ar)
  8. asList(int[] arr)
  9. asList(int[] ints)