Java List from Array asList(int[] ar)

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

Description

as List

License

Open Source License

Declaration

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

Method Source Code

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

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<Integer> asList(int[] ar) {
        List<Integer> list = new ArrayList<Integer>(ar.length);
        for (int a : ar)
            list.add(a);/*  w  w w .  ja  va  2  s. com*/
        return list;
    }

    public static double[] add(double[] a, double b) {
        for (int i = 0; i < a.length; i++) {
            a[i] += b;
        }
        return a;
    }

    public static double[] add(double[] a, double scale, double[] b) {
        for (int i = 0; i < a.length; i++) {
            a[i] += scale * b[i];
        }
        return a;
    }
}

Related

  1. asList(int... array)
  2. asList(int... data)
  3. asList(int... values)
  4. asList(int[] a)
  5. asList(int[] ai)
  6. asList(int[] arr)
  7. asList(int[] ints)
  8. asList(int[] list)
  9. asList(int[] values)