Java examples for java.util:List Operation
make String List from String Array
//package com.java2s; import java.util.List; import java.util.ArrayList; import java.util.Arrays; public class Main { public static void main(String[] argv) { String[] array = new String[] { "1", "abc", "level", null, "java2s.com", "asdf 123" }; System.out.println(makeList(array)); }// w w w .j a v a 2 s .c o m public static List<String> makeList(String[] array) { List<String> result; if (array != null) { result = new ArrayList<String>(array.length); result.addAll(Arrays.asList(array)); } else { result = null; } return result; } }