List of utility methods to do List from Array
List | asList(String... args) as List if (args == null) return null; List<String> list = new ArrayList<String>(); for (String arg : args) { list.add(arg); return list; |
List | asList(String... strings) Returns from a variable number of String parameters a List<String>
List<String> listOfStrings = new ArrayList<>(strings.length); for (int i = 0; i < strings.length; i++) { listOfStrings.add(strings[i]); return listOfStrings; |
List | asList(T element) as List return Collections.singletonList(element);
|
List | asList(T firstItem, T... otherItems) as List List<T> list = new ArrayList<>(otherItems.length + 1); list.add(firstItem); Collections.addAll(list, otherItems); return list; |
List | asList(T... a) as List if (a == null) { return new ArrayList<T>(); ArrayList<T> list = new ArrayList<T>(a.length); list.addAll(Arrays.asList(a)); return list; |
ArrayList | asList(T... a) Return an ArrayList with the passed array or elements as the initial contents. ArrayList<T> result = new ArrayList<T>(); for (T t : a) { result.add(t); return result; |
List | asList(T... a) as List List<T> rtn = null; if (a != null) { rtn = Arrays.asList(a); return rtn; |
List | asList(T... a) Returns a list backed by the specified array. ArrayList<T> list = new ArrayList<T>(); for (T elem : a) list.add(elem); return list; |
List | asList(T... args) as List if (args == null || args.length == 0) { return Collections.emptyList(); } else { return Arrays.asList(args); |
List | asList(T... args) Null-safe version of java.util.Arrays#asList(Object[]) return args == null ? null : Arrays.asList(args);
|