Java examples for Collection Framework:List
T[] array to List<T>
//package com.java2s; import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> toList(T[] elems) { ArrayList<T> list = new ArrayList<>(); for (T elem : elems) { list.add(elem);//ww w.ja v a 2 s. c o m } return list; } }