Java tutorial
//package com.java2s; //License from project: Apache License import java.lang.reflect.Array; import java.util.List; public class Main { public static <T extends Object> T[] toArray(List<T> list) { if (list == null || list.isEmpty()) return null; T[] array = (T[]) Array.newInstance(list.get(0).getClass(), list.size()); for (int i = 0; i < array.length; i++) array[i] = list.get(i); return array; } public static <M extends Object> boolean isEmpty(M[] array) { return array == null || array.length == 0; } }