Java tutorial
//package com.java2s; import java.lang.reflect.Array; import java.util.List; public class Main { public static <T> T[] toArray(List<T> list, Class<T> clazz) { @SuppressWarnings("unchecked") T[] result = (T[]) Array.newInstance(clazz, list.size()); for (int i = 0; i < list.size(); i++) { result[i] = list.get(i); } return result; } }