Android examples for java.lang:array convert
Convert Array to List
import java.util.ArrayList; import java.util.List; public class Main { public static <M extends Object> List<M> toList(M[] array) { if (array == null) return new ArrayList<>(); List<M> result = new ArrayList<>(array.length); for (M m : array) result.add(m);/* ww w .j a va 2 s. co m*/ return result; } }