Java List from Array asList(int[] ints)

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

Description

as List

License

Open Source License

Declaration

public static List asList(int[] ints) 

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 asList(int[] ints) {
        List list = new ArrayList();
        for (int i = 0; i < ints.length; i++) {
            list.add(i, ints[i]);//from   w w w . ja  v  a2  s. c  om
        }
        return list;
    }

    public static List asList(String[] var1) {
        List list = new ArrayList();
        for (int i = 0; i < var1.length; i++) {
            list.add(i, var1[i]);
        }
        return list;
    }

    public static List asList(boolean[] var1) {
        List list = new ArrayList();
        for (int i = 0; i < var1.length; i++) {
            list.add(i, var1[i]);
        }
        return list;
    }

    public static List asList(float[] var1) {
        List list = new ArrayList();
        for (int i = 0; i < var1.length; i++) {
            list.add(i, var1[i]);
        }
        return list;
    }

    public static List asList(Object[] var1) {
        List list = new ArrayList();
        for (int i = 0; i < var1.length; i++) {
            list.add(i, var1[i]);
        }
        return list;
    }
}

Related

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