Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collection; import java.util.LinkedList; import java.util.List; import java.util.Map; public class Main { public static <T> List<T> arrayToList(T[] objs) { if (isEmpty(objs)) { return null; } List<T> list = new LinkedList<T>(); for (T obj : objs) { list.add(obj); } return list; } public static <T> boolean isEmpty(T[] array) { return (array == null || array.length == 0); } public static boolean isEmpty(Collection collection) { return (collection == null || collection.isEmpty()); } public static boolean isEmpty(Map map) { return (map == null || map.isEmpty()); } }