Convert int array to List - Android java.lang

Android examples for java.lang:array convert

Description

Convert int array to List

Demo Code

import android.util.SparseArray;
import java.util.ArrayList;
import java.util.List;

public class Main{

    public static ArrayList<Integer> asList(int... arr) {
        ArrayList<Integer> list = new ArrayList<>(arr.length);
        for (int i = 0; i < arr.length; i++) {
            list.add(Integer.valueOf(arr[i]));
        }//from   w w w . ja v a 2 s.c om
        return list;

    }

}

Related Tutorials