public static <T> T[] toArray(final List<T> obj) {
	    if (obj == null || obj.isEmpty()) {
	        return null;
	    }
	    final T t = obj.get(0);
		final T[] res = (T[]) Array.newInstance(t.getClass(), obj.size());
	    for (int i = 0; i < obj.size(); i++) {
	        res[i] = obj.get(i);
	    }
	    return res;
	}