Java tutorial
//package com.java2s; import java.lang.reflect.Array; import java.util.Collection; public class Main { public static <T> T[] convertArrayToList(Collection<T> list) { return (T[]) (list.size() > 0 ? list.toArray((Object[]) Array.newInstance(list.iterator().next().getClass(), list.size())) : null); } }