Java tutorial
//package com.java2s; import java.io.File; import java.util.Collection; public class Main { public static File[] asFileArray(Collection<File> coll) { return asArray(coll, new File[coll.size()]); } public static <T> T[] asArray(Collection<T> coll, T[] arr) { int i = 0; for (T o : coll) { arr[i++] = o; } return arr; } }